| 1 |
// PR c++/115657 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
// Like constexpr-recursion1.C but use a class with a conversion function. |
| 6 |
|
| 7 |
struct X { |
| 8 |
constexpr operator int() { return 0; } |
| 9 |
}; |
| 10 |
|
| 11 |
template <int N> |
| 12 |
constexpr X f1 () |
| 13 |
{ |
| 14 |
enum E { a = f1<0> () }; // { dg-error "called in a constant expression before its definition is complete|is not an integer constant" } |
| 15 |
return {}; |
| 16 |
} |
| 17 |
|
| 18 |
constexpr X f3 () |
| 19 |
{ |
| 20 |
enum E { a = f3 () }; // { dg-error "called in a constant expression before its definition is complete|is not an integer constant" } |
| 21 |
return {}; |
| 22 |
} |