diff options
Diffstat (limited to 'test/PCH/cxx1y-decltype-auto.cpp')
-rw-r--r-- | test/PCH/cxx1y-decltype-auto.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/PCH/cxx1y-decltype-auto.cpp b/test/PCH/cxx1y-decltype-auto.cpp new file mode 100644 index 0000000000..a1c9339cb6 --- /dev/null +++ b/test/PCH/cxx1y-decltype-auto.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t +// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s + +#ifndef HEADER_INCLUDED + +#define HEADER_INCLUDED + +template<typename T> void f(T t) { + auto a = t.x; + decltype(auto) b = t.x; + auto c = (t.x); + decltype(auto) d = (t.x); +} + +#else + +struct Z { + int x : 5; // expected-note {{bit-field}} +}; + +// expected-error@12 {{non-const reference cannot bind to bit-field 'x'}} +template void f(Z); // expected-note {{in instantiation of}} + +#endif |