diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2013-04-26 12:11:14 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-04-26 12:11:14 +0000 |
commit | 6e03fa931c3264b82681e0f7894e161e148dbfc5 (patch) | |
tree | 142519b02cac74dc13014b3368613d7e6c906185 /gcc | |
parent | df93505e2e566e1f99e2d26b2d8471c8b0f84bef (diff) | |
download | gcc-6e03fa931c3264b82681e0f7894e161e148dbfc5.zip gcc-6e03fa931c3264b82681e0f7894e161e148dbfc5.tar.gz gcc-6e03fa931c3264b82681e0f7894e161e148dbfc5.tar.bz2 |
re PR c++/55708 (g++ crashes: constexpr function with reference parameters.)
2013-04-26 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55708
* g++.dg/cpp0x/constexpr-55708.C: New.
From-SVN: r198337
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-55708.C | 30 |
2 files changed, 36 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 737ef4a..1081ef9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ -2013-03-26 Richard Biener <rguenther@suse.de> +2013-04-26 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/55708 + * g++.dg/cpp0x/constexpr-55708.C: New. + +2013-04-26 Richard Biener <rguenther@suse.de> * 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 0000000..ffbefbb --- /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<int N,int NNN> +struct AA { static constexpr int val = N; }; + +template<typename A,typename B> +//constexpr unsigned long long mymax(A a,B b){ // <-- compiles +constexpr unsigned long long mymax(A && a,const B& b){ + return a<b?b:a; +} + +template<char... List> +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<char... List> +constexpr unsigned long long do_y() noexcept +{ + return AA<1, mymax(1,2)>::val; // <-- crashes gcc +} + +int main() +{ + return 1_y + do_y(); +} |