https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106549

            Bug ID: 106549
           Summary: excessive error messages with nested undefined
                    template
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de
  Target Milestone: ---

% cat test.cpp
void f (X <X <X <X <X <X <X <int>>>>>>>);
% g++ --std=c++20 test.cpp |& head -n 30
test.cpp:1:27: error: 'X' was not declared in this scope
    1 | void f (X <X <X <X <X <X <X <int>>>>>>>);
      |                           ^
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:24: error: 'X' was not declared in this scope
    1 | void f (X <X <X <X <X <X <X <int>>>>>>>);
      |                        ^
test.cpp:1:27: error: 'X' was not declared in this scope
    1 | void f (X <X <X <X <X <X <X <int>>>>>>>);
      |                           ^
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
test.cpp:1:27: error: 'X' was not declared in this scope
% g++ --std=c++20 test.cpp |& wc        
2921195 24780807 155318228

I don't have newer GCC versions installed locally, but according to a Godbolt
test, it seems to happen with them too (but since Godbolt truncates the
messages, I can't tell whether they produce quite the same amount).

The number of messages seems to grow exponentially with the number of template
nestings with a growth factor >11.

PS: Couldn't resist the opportunity to turn compiler output into an
animation/screensaver: ;)
g++ --std=c++20 test.cpp |& sed -un 's/   / /g;s/^  |     //p' | tr -d '\n'

Reply via email to