https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63388
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmalcolm at gcc dot gnu.org
--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
$ ./xg++ -B. -S
../../src/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C -fanalyzer
../../src/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C: In
function ‘std::ostream& operator<<(std::ostream&, Month)’:
../../src/gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C:13:16:
warning: infinite recursion [CWE-674] [-Wanalyzer-infinite-recursion]
13 | return os << m; // { dg-warning "infinite recursion" }
| ^
‘std::ostream& operator<<(std::ostream&, Month)’: events 1-2
│
│ 11 | std::ostream& operator<<(std::ostream& os, Month m)
│ | ^~~~~~~~
│ | |
│ | (1) initial entry to ‘operator<<’
│ 12 | {
│ 13 | return os << m; // { dg-warning "infinite recursion" }
│ | ~
│ | |
│ | (2) calling ‘operator<<’ from ‘operator<<’
│
└──> ‘std::ostream& operator<<(std::ostream&, Month)’: events 3-4
│
│ 11 | std::ostream& operator<<(std::ostream& os, Month m)
│ | ^~~~~~~~
│ | |
│ | (3) recursive entry to ‘operator<<’;
previously entered at (1)
│ | (4) ⚠️ apparently infinite recursion
│