xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/cxx11-user-defined-literals.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
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
3 
4 #ifndef HEADER_INCLUDED
5 
6 #define HEADER_INCLUDED
7 
8 using size_t = decltype(sizeof(int));
9 int operator"" _foo(const char *p, size_t);
10 
f(T t)11 template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; }
12 
13 #else
14 
15 int j = ""_foo;
16 int k = f(0);
17 int *l = f(&k);
18 struct S {};
19 int m = f(S()); // expected-error {{no matching}}
20                 // expected-note@11 {{substitution failure}}
21 
22 #endif
23