diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2015-03-20 17:26:32 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-03-20 17:26:32 +0000 |
commit | e251e8157e03185147aae03265bae837a54042a5 (patch) | |
tree | 5a8f8f639e7116807564845562c7b2d88b1203ad /gcc | |
parent | c00acee464fa8e4c4fb4717b342f2b2fc4d4eb3f (diff) | |
download | gcc-e251e8157e03185147aae03265bae837a54042a5.zip gcc-e251e8157e03185147aae03265bae837a54042a5.tar.gz gcc-e251e8157e03185147aae03265bae837a54042a5.tar.bz2 |
re PR c++/48324 ([C++0x] constexpr evaluation should respect lifetime rules)
2015-03-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/48324
* g++.dg/cpp0x/constexpr-48324.C: New.
From-SVN: r221539
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-48324.C | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 585c912..9e55738 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2015-03-20 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/48324 + * g++.dg/cpp0x/constexpr-48324.C: New. + +2015-03-20 Paolo Carlini <paolo.carlini@oracle.com> + PR c++/48453 * g++.dg/cpp0x/pr48453.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-48324.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-48324.C new file mode 100644 index 0000000..cef464c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-48324.C @@ -0,0 +1,13 @@ +// PR c++/48324 +// { dg-do compile { target c++11 } } + +struct S { + const int val; + constexpr S(int i) : val(i) { } +}; + +constexpr const int& to_ref(int i) { + return S(i).val; // { dg-warning "reference to temporary" } +} + +constexpr int ary[to_ref(98)] = { }; // { dg-error "not an integral" } |