1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
2 
3 #include <stddef.h>
4 
5 struct tag {
6   void operator "" _tag_bad (const char *); // expected-error {{literal operator 'operator""_tag_bad' must be in a namespace or global scope}}
7   friend void operator "" _tag_good (const char *);
8 };
9 
10 namespace ns { void operator "" _ns_good (const char *); }
11 
12 // Check extern "C++" declarations
13 extern "C++" void operator "" _extern_good (const char *);
14 extern "C++" { void operator "" _extern_good (const char *); }
15 
16 void fn () { void operator "" _fn_good (const char *); }
17 
18 // One-param declarations (const char * was already checked)
19 void operator "" _good (char);
20 void operator "" _good (wchar_t);
21 void operator "" _good (char16_t);
22 void operator "" _good (char32_t);
23 void operator "" _good (unsigned long long);
24 void operator "" _good (long double);
25 
26 // Two-param declarations
27 void operator "" _good (const char *, size_t);
28 void operator "" _good (const wchar_t *, size_t);
29 void operator "" _good (const char16_t *, size_t);
30 void operator "" _good (const char32_t *, size_t);
31 
32 // Check typedef and array equivalences
33 void operator "" _good (const char[]);
34 typedef const char c;
35 void operator "" _good (c*);
36 
37 // Check extra cv-qualifiers
38 void operator "" _cv_good (volatile const char *, const size_t); // expected-error {{invalid literal operator parameter type 'const volatile char *', did you mean 'const char *'?}}
39 
40 // Template declaration
41 template <char...> void operator "" _good ();
42 
43 template <typename...> void operator "" _invalid(); // expected-error {{template parameter list for literal operator must be either 'char...' or 'typename T, T...'}}
44 template <wchar_t...> void operator "" _invalid();  // expected-error {{template parameter list for literal operator must be either 'char...' or 'typename T, T...'}}
45 template <unsigned long long...> void operator "" _invalid();  // expected-error {{template parameter list for literal operator must be either 'char...' or 'typename T, T...'}}
46 
47 _Complex float operator""if(long double); // expected-warning {{reserved}}
48 _Complex float test_if_1() { return 2.0f + 1.5if; };
49 void test_if_2() { "foo"if; } // expected-error {{no matching literal operator for call to 'operator""if'}}
50