diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | bfef399519ca9b8a4b4c6b563253bad7e0eeffe0 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/SemaCXX/warn-dangling-field.cpp | |
parent | 6a0372513edbc473b538d2f724efac50405d6fef (diff) |
Diffstat (limited to 'test/SemaCXX/warn-dangling-field.cpp')
-rw-r--r-- | test/SemaCXX/warn-dangling-field.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/SemaCXX/warn-dangling-field.cpp b/test/SemaCXX/warn-dangling-field.cpp index 95f8c61ebb77..eb65bd06692c 100644 --- a/test/SemaCXX/warn-dangling-field.cpp +++ b/test/SemaCXX/warn-dangling-field.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -Wdangling-field -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wdangling-field -verify -std=c++11 %s struct X { X(int); @@ -35,3 +35,17 @@ template <typename T> struct S4 { template struct S4<int>; // no warning from this instantiation template struct S4<int&>; // expected-note {{in instantiation}} + +struct S5 { + const X &x; // expected-note {{here}} +}; +S5 s5 = { 0 }; // ok, lifetime-extended + +struct S6 { + S5 s5; // expected-note {{here}} + S6() : s5 { 0 } {} // expected-warning {{binding reference subobject of member 's5' to a temporary}} +}; + +struct S7 : S5 { + S7() : S5 { 0 } {} // expected-warning {{binding reference member 'x' to a temporary}} +}; |