[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / cxx11-user-defined-literals.cpp
blobcf3dc8cf5a17c54b954f52917985b91e928e7656
1 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
2 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
4 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch -fpch-instantiate-templates %s -o %t
5 // RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
7 #ifndef HEADER_INCLUDED
9 #define HEADER_INCLUDED
11 using size_t = decltype(sizeof(int));
12 int operator"" _foo(const char *p, size_t);
14 template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; }
16 #else
18 int j = ""_foo;
19 int k = f(0);
20 int *l = f(&k);
21 struct S {};
22 int m = f(S()); // expected-error {{no matching}}
23 // expected-note@14 {{substitution failure}}
25 #endif