Richard Smith e3b28bc363 Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.

llvm-svn: 183869
2013-06-12 21:51:50 +00:00

14 lines
494 B
C++

// RUN: %clang_cc1 -verify %s -std=c++11
template<const int I> struct S {
decltype(I) n;
int &&r = I; // expected-warning 2{{binding reference member 'r' to a temporary value}} expected-note 2{{declared here}}
};
S<5> s; // expected-note {{instantiation}}
template<typename T, T v> struct U {
decltype(v) n;
int &&r = v; // expected-warning {{binding reference member 'r' to a temporary value}} expected-note {{declared here}}
};
U<const int, 6> u; // expected-note {{instantiation}}