diff options
Diffstat (limited to 'test/PCH/cxx1y-init-captures.cpp')
-rw-r--r-- | test/PCH/cxx1y-init-captures.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/PCH/cxx1y-init-captures.cpp b/test/PCH/cxx1y-init-captures.cpp new file mode 100644 index 0000000000..3c8fc149d8 --- /dev/null +++ b/test/PCH/cxx1y-init-captures.cpp @@ -0,0 +1,28 @@ +// No PCH: +// RUN: %clang_cc1 -pedantic -std=c++1y -include %s -verify %s +// +// With PCH: +// 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 +#define HEADER + +auto counter = [a(0)] () mutable { return a++; }; +int x = counter(); + +template<typename T> void f(T t) { + [t(t)] { int n = t; } (); +} + +#else + +int y = counter(); + +void g() { + f(0); // ok + // expected-error@15 {{lvalue of type 'const char *const'}} + f("foo"); // expected-note {{here}} +} + +#endif |