-
-
Notifications
You must be signed in to change notification settings - Fork 182
Description
Environment
toml++ version and/or commit hash:
Commit Hash: 1f7884e
Compiler:
MSVC 2019 Version 1940
C++ standard mode:
C++20
Target arch:
x64
Library configuration overrides:
None, using default configurations
Relevant compilation flags:
Describe the bug
When attempting to use the toml++
library within a C++20 module, I encounter an internal compiler error during compilation. The error seems to occur when the library header (toml.hpp
) is included in the global module fragment of a C++20 module. The issue appears specific to scenarios where the library is included and utilized within the module definition.
The exact compiler error:
>Kompilieren...
1>TomlPlusPlus.ixx
1>\TomlPlusPlus.ixx(12,1): error C1001: Interner Compilerfehler.
1>\TomlPlusPlus.ixx(12,1): error C1001: (Compilerdatei "D:\a\_work\1\s\src\vctools\Compiler\CxxFE\sl\p1\c\module\writer.cpp", Zeile 6786)
1>\TomlPlusPlus.ixx(12,1): error C1001: Um dieses Problem zu umgehen, vereinfachen oder ändern Sie das Programm im Umfeld der oben aufgeführten Positionen.
1>\TomlPlusPlus.ixx(12,1): error C1001: Geben Sie nach Möglichkeit hier Reproduktionsschritte an: https://developercommunity.visualstudio.com
1>\TomlPlusPlus.ixx(12,1): error C1001: Wählen Sie im Menü "Hilfe" von Visual C++ den Befehl "Technischer Support",
1>\TomlPlusPlus.ixx(12,1): error C1001: oder öffnen Sie die Hilfedatei des technischen Supports, um weitere Informationen zu erhalten.
1>Die Erstellung des Projekts "SharedCode.vcxproj" ist abgeschlossen -- FEHLER.
Steps to reproduce (or a small repro code sample)
- Set up a C++ project with C++20 and module support enabled in MSVC.
- Include
toml++
using the global module fragment in a module file. - Attempt to parse a TOML file using
toml++
within a module's function. - Compile the project, which triggers the internal compiler error.
Example code snippet:
cpp
module;
#include <toml.hpp>
export module Configuration;
export class Configuration {
public:
void LoadFromFile(const std::string& filename) {
auto config = toml::parse_file(filename); // Usage of toml++
}
};
Additional information
The internal compiler error is sound like a compiler bug with modules, but I have no idea what in toml++ breaks the compiler which I think is a reason why they ignored my report so far. When you include it in a c++20 module. Fixing this would require finding a workaround for whatever causes the internal compiler error, or maybe providing a c++20 module version of the library.