This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48324] New: [C++0x] constexpr evaluation should respect lifetime rules
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 Mar 2011 00:01:32 +0000
- Subject: [Bug c++/48324] New: [C++0x] constexpr evaluation should respect lifetime rules
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48324
Summary: [C++0x] constexpr evaluation should respect lifetime
rules
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jason@gcc.gnu.org
// { dg-options -std=c++0x }
struct S {
const int val;
constexpr S(int i) : val(i) { }
};
constexpr const int& to_ref(int i) {
return S(i).val;
}
constexpr int ary[to_ref(98)] = { }; // { dg-error "use of dead temporary" }
int main() { }