brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · cf26806 Raw
45 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -verify2 3void operator ""_a(const char *);4 5namespace N {6  using ::operator ""_a;7 8  void operator ""_b(const char *);9}10 11using N::operator ""_b;12 13class C {14  void operator ""_c(const char *); // expected-error {{must be in a namespace or global scope}}15 16  static void operator ""_c(unsigned long long); // expected-error {{must be in a namespace or global scope}}17 18  friend void operator ""_d(const char *);19};20 21int operator ""_e; // expected-error {{cannot be the name of a variable}}22 23void f() {24  int operator ""_f; // expected-error {{cannot be the name of a variable}}25}26 27extern "C++" {28  void operator ""_g(const char *);29}30 31template<char...> void operator ""_h() {}32 33template<> void operator ""_h<'a', 'b', 'c'>() {}34 35template void operator ""_h<'a', 'b', 'c', 'd'>();36 37namespace rdar13605348 {38 39class C {40  double operator""_x(long double value) { return double(value); } // expected-error{{literal operator 'operator""_x' must be in a namespace or global scope}}41  double value() { return 3.2_x; } // expected-error{{no matching literal operator for call to}}42};43 44}45