From: Paolo Carlini Date: Fri, 26 Apr 2013 12:11:14 +0000 (+0000) Subject: re PR c++/55708 (g++ crashes: constexpr function with reference parameters.) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e03fa931c3264b82681e0f7894e161e148dbfc5;p=gcc.git re PR c++/55708 (g++ crashes: constexpr function with reference parameters.) 2013-04-26 Paolo Carlini PR c++/55708 * g++.dg/cpp0x/constexpr-55708.C: New. From-SVN: r198337 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 737ef4a926f..1081ef99251 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2013-03-26 Richard Biener +2013-04-26 Paolo Carlini + + PR c++/55708 + * g++.dg/cpp0x/constexpr-55708.C: New. + +2013-04-26 Richard Biener * gcc.dg/tree-prof/update-loopch.c: Revert last change. * gcc.dg/graphite/pr33766.c: Fix undefined behavior. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-55708.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-55708.C new file mode 100644 index 00000000000..ffbefbbac46 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-55708.C @@ -0,0 +1,30 @@ +// PR c++/55708 +// { dg-do compile { target c++11 } } + +template +struct AA { static constexpr int val = N; }; + +template +//constexpr unsigned long long mymax(A a,B b){ // <-- compiles +constexpr unsigned long long mymax(A && a,const B& b){ + return a +constexpr long long operator"" _y() noexcept +{ + return AA<1, mymax(1,2)>::val; // <-- crashes gcc + // return mymax(1,2); // <-- compiles + // return AA<1,2>::val; // <-- compiles +} + +template +constexpr unsigned long long do_y() noexcept +{ + return AA<1, mymax(1,2)>::val; // <-- crashes gcc +} + +int main() +{ + return 1_y + do_y(); +}