Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Compiler Error when including header in global module fragment (C++ 20 modules) #229

Open
KeinNiemand opened this issue Jun 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@KeinNiemand
Copy link

KeinNiemand commented Jun 26, 2024

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)

  1. Set up a C++ project with C++20 and module support enabled in MSVC.
  2. Include toml++ using the global module fragment in a module file.
  3. Attempt to parse a TOML file using toml++ within a module's function.
  4. 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.

@KeinNiemand KeinNiemand added the bug Something isn't working label Jun 26, 2024
@marzer
Copy link
Owner

marzer commented Jun 29, 2024

The exact compiler error:

...can you post it in English?, oh, wait, it's an ICE. I guess it is unlikely to say anything overly helpful, regardless of language 😅

You're not the first to have issues with modules and toml++: #172 Sadly I'm unlikely to find time to do anything about this. Can you share a link to your bug report ticket? That way I can at least track it, up-vote it, et cetera.

@KeinNiemand
Copy link
Author

Ok here is the Bug Report Ticket Link.

@marzer
Copy link
Owner

marzer commented Jul 8, 2024

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants