| 1 |
// PR c++/55708 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<int N,int NNN> |
| 5 |
struct AA { static constexpr int val = N; }; |
| 6 |
|
| 7 |
template<typename A,typename B> |
| 8 |
//constexpr unsigned long long mymax(A a,B b){ // <-- compiles |
| 9 |
constexpr unsigned long long mymax(A && a,const B& b){ |
| 10 |
return a<b?b:a; |
| 11 |
} |
| 12 |
|
| 13 |
template<char... List> |
| 14 |
constexpr long long operator ""_y() noexcept |
| 15 |
{ |
| 16 |
return AA<1, mymax(1,2)>::val; // <-- crashes gcc |
| 17 |
// return mymax(1,2); // <-- compiles |
| 18 |
// return AA<1,2>::val; // <-- compiles |
| 19 |
} |
| 20 |
|
| 21 |
template<char... List> |
| 22 |
constexpr unsigned long long do_y() noexcept |
| 23 |
{ |
| 24 |
return AA<1, mymax(1,2)>::val; // <-- crashes gcc |
| 25 |
} |
| 26 |
|
| 27 |
int main() |
| 28 |
{ |
| 29 |
return 1_y + do_y(); |
| 30 |
} |