https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109012
Bug ID: 109012 Summary: Repeated error messages when using -std=c++23 Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stevenxia990430 at gmail dot com Target Milestone: --- The following incomplete program repeatedly reports the same error message on GCC 12 with “-std=c++23” flag. To quickly reproduce: https://gcc.godbolt.org/z/Ehzde5o4T ``` #include <iostream> template <class T> myClass<myClass<myClass<myClass<myClass<T>>>>> myFunction(T item) { std::cout << "Hello World!"; } ``` So the C++23 parser seems to have a bug. If we remove “-std=c++23” it only reports the concise error message once: https://gcc.godbolt.org/z/38Gxne859 Additionally, this also occurs for even syntactically invalid code snippets. For example this code ``` myClass<myClass<myClass<myClass<myClass<int>>>>>((( myFunction(int item) ``` Also observe the same behavior, although clearly it is syntactically invalid. This correct program compiles in less than 1 second with “g++ -c -std=c++23 correct.cpp” ``` #include <iostream> template<typename T> class myClass { public: void myFunction(const T item); }; template <class T> myClass<myClass<myClass<myClass<myClass<T>>>>> myFunction(T item) { std::cout << "Hello World!"; } ``` correct.cpp