1b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith// RUN: %clang_cc1 -std=c++11 %s -verify 2b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 3b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithvoid operator "" _a(const char *); 4b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 5b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithnamespace N { 6b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith using ::operator "" _a; 7b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 8b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith void operator "" _b(const char *); 9b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith} 10b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 11b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithusing N::operator "" _b; 12b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 13b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithclass C { 14b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith void operator "" _c(const char *); // expected-error {{must be in a namespace or global scope}} 15b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 16e5658f0ab2a6f8fea258adb64edbb8485bb21deeRichard Smith static void operator "" _c(unsigned long long); // expected-error {{must be in a namespace or global scope}} 17e5658f0ab2a6f8fea258adb64edbb8485bb21deeRichard Smith 18b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith friend void operator "" _d(const char *); 19b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith}; 20b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 21b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithint operator "" _e; // expected-error {{cannot be the name of a variable}} 22b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 23b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithvoid f() { 24b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith int operator "" _f; // expected-error {{cannot be the name of a variable}} 25b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith} 26b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith 27b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smithextern "C++" { 28b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith void operator "" _g(const char *); 29b4a7b1e587a232c95d02a8ca10eeba60164fbba1Richard Smith} 303a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smith 313a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smithtemplate<char...> void operator "" _h() {} 323a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smith 333a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smithtemplate<> void operator "" _h<'a', 'b', 'c'>() {} 343a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smith 353a5032b89df601ab2e0c5c7e9667db2301bf10cfRichard Smithtemplate void operator "" _h<'a', 'b', 'c', 'd'>(); 36