gcc/testsuite/g++.dg/analyzer/infinite-recursion-pr63388.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | namespace std |
| 4 | { |
| 5 | class ostream; |
| 6 | extern ostream cout; |
| 7 | } |
| 8 | |
| 9 | enum class Month {jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec}; |
| 10 | |
| 11 | std::ostream& operator<<(std::ostream& os, Month m) |
| 12 | { |
| 13 | return os << m; // { dg-warning "infinite recursion" } |
| 14 | } |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | Month m = Month::may; |
| 19 | std::cout << m; |
| 20 | return 0; |
| 21 | } |