diff options
author | Marek Polacek <polacek@redhat.com> | 2019-08-08 17:54:58 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-08-08 17:54:58 +0000 |
commit | 355229f22a06073a288f6da189ea2757c5e09e30 (patch) | |
tree | 6d793e3ac569c44059b41f68dad4b3354b2af002 | |
parent | 99769e7fb6ed153a53174b7f08415eee347655f0 (diff) | |
download | gcc-355229f22a06073a288f6da189ea2757c5e09e30.zip gcc-355229f22a06073a288f6da189ea2757c5e09e30.tar.gz gcc-355229f22a06073a288f6da189ea2757c5e09e30.tar.bz2 |
re PR c++/79520 (Spurious caching for constexpr arguments)
PR c++/79520
* g++.dg/cpp1y/constexpr-79520.C: New test.
From-SVN: r274214
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/constexpr-79520.C | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9f6c54..c44e379 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-08 Marek Polacek <polacek@redhat.com> + + PR c++/79520 + * g++.dg/cpp1y/constexpr-79520.C: New test. + 2019-08-08 Richard Sandiford <richard.sandiford@arm.com> * gcc.dg/pr79983.c (enum E): Don't allow an error about nested diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-79520.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-79520.C new file mode 100644 index 0000000..a53bb3e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-79520.C @@ -0,0 +1,11 @@ +// PR c++/79520 +// { dg-do compile { target c++14 } } + +constexpr int f(int const& x) { return x; } + +constexpr struct S { + int x = 0; + constexpr S() {(void)f(x); x = 1;} +} s; + +static_assert(f(s.x) == 1, ""); |