Commit e251e815 by Paolo Carlini Committed by Paolo Carlini

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
parent c00acee4
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.
......
// 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" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment