From: Paolo Carlini Date: Wed, 1 Jun 2016 09:48:05 +0000 (+0000) Subject: re PR c++/66635 (g++ ICE when compiling constexpr code with comma operator) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48de570121fa393e003a11f63a85b862a0c1030e;p=gcc.git re PR c++/66635 (g++ ICE when compiling constexpr code with comma operator) 2016-06-01 Paolo Carlini PR c++/66635 * g++.dg/cpp0x/constexpr-ice16.C: New. From-SVN: r236978 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c806fdb2f54..c6e4a61cfa0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-01 Paolo Carlini + + PR c++/66635 + * g++.dg/cpp0x/constexpr-ice16.C: New. + 2016-06-01 Patrick Palka PR tree-optimization/71314 @@ -11,9 +16,9 @@ 2016-05-31 Jan Hubicka - * g++.d/predict-lop-exit-1.C: Update template for new predictor name. - * g++.d/predict-lop-exit-2.C: Update template for new predictor name. - * g++.d/predict-lop-exit-2.C: Update template for new predictor name. + * g++.dg/predict-lop-exit-1.C: Update template for new predictor name. + * g++.dg/predict-lop-exit-2.C: Update template for new predictor name. + * g++.dg/predict-lop-exit-2.C: Update template for new predictor name. 2016-05-31 Paolo Carlini diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C new file mode 100644 index 00000000000..42b9226dcd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C @@ -0,0 +1,14 @@ +// PR c++/66635 +// { dg-do compile { target c++11 } } + +#include + +struct Foo { + constexpr Foo(const unsigned i) : val(i) {} + constexpr Foo operator-(const Foo &rhs) const { + return assert(val >= rhs.val), Foo(val - rhs.val); // { dg-error "call to non-constexpr" } + } + unsigned val; +}; + +constexpr Foo foo(Foo(1) - Foo(2));