1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2 3#include <stddef.h> 4 5struct 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 10namespace ns { void operator "" _ns_good (const char *); } 11 12// Check extern "C++" declarations 13extern "C++" void operator "" _extern_good (const char *); 14extern "C++" { void operator "" _extern_good (const char *); } 15 16void fn () { void operator "" _fn_good (const char *); } 17 18// One-param declarations (const char * was already checked) 19void operator "" _good (char); 20void operator "" _good (wchar_t); 21void operator "" _good (char16_t); 22void operator "" _good (char32_t); 23void operator "" _good (unsigned long long); 24void operator "" _good (long double); 25 26// Two-param declarations 27void operator "" _good (const char *, size_t); 28void operator "" _good (const wchar_t *, size_t); 29void operator "" _good (const char16_t *, size_t); 30void operator "" _good (const char32_t *, size_t); 31 32// Check typedef and array equivalences 33void operator "" _good (const char[]); 34typedef const char c; 35void operator "" _good (c*); 36 37// Check extra cv-qualifiers 38void 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 41template <char...> void operator "" _good (); 42 43// FIXME: Test some invalid decls that might crop up. 44template <typename...> void operator "" _invalid(); // expected-error {{parameter declaration for literal operator 'operator "" _invalid' is not valid}} 45