45 lines · cpp
1// RUN: %clang_cc1 -std=c++1y %s -include %s -verify2 3#ifndef INCLUDED4#define INCLUDED5 6#pragma clang system_header7namespace std {8 using size_t = decltype(sizeof(0));9 10 struct duration {};11 duration operator""ns(unsigned long long);12 duration operator""us(unsigned long long);13 duration operator""ms(unsigned long long);14 duration operator""s(unsigned long long);15 duration operator""min(unsigned long long);16 duration operator""h(unsigned long long);17 18 struct string {};19 string operator""s(const char*, size_t);20 21 template<typename T> struct complex {};22 complex<float> operator""if(long double);23 complex<float> operator""if(unsigned long long);24 complex<double> operator""i(long double);25 complex<double> operator""i(unsigned long long);26 complex<long double> operator""il(long double);27 complex<long double> operator""il(unsigned long long);28}29 30#else31 32using namespace std;33duration a = 1ns, b = 1us, c = 1ms, d = 1s, e = 1min, f = 1h;34string s = "foo"s;35char error = 'x's; // expected-error {{invalid suffix}} expected-error {{expected ';'}}36 37int _1y = 1y; // expected-error {{invalid suffix}}38int _1b = 1b; // expected-error {{invalid digit}}39 40complex<float> cf1 = 1if, cf2 = 2.if, cf3 = 0x3if;41complex<double> cd1 = 1i, cd2 = 2.i, cd3 = 0b0110101i;42complex<long double> cld1 = 1il, cld2 = 2.il, cld3 = 0047il;43 44#endif45