1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %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 
fn()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 {{parameter declaration for literal operator 'operator "" _cv_good' is not valid}}
39 
40 // Template declaration
41 template <char...> void operator "" _good ();
42 
43 // FIXME: Test some invalid decls that might crop up.
44 template <typename...> void operator "" _invalid(); // expected-error {{parameter declaration for literal operator 'operator "" _invalid' is not valid}}
45