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