1560a3579SRichard Smith // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s
2227c352bSDouglas Gregor // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
3560a3579SRichard Smith // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s
4*cbaaa295SRichard Smith // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s
5560a3579SRichard Smith double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}}
6560a3579SRichard Smith 
7560a3579SRichard Smith float f = 0x1p+1;
8560a3579SRichard Smith double d = 0x.2p2;
9560a3579SRichard Smith float g = 0x1.2p2;
10560a3579SRichard Smith double h = 0x1.p2;
11560a3579SRichard Smith #if __cplusplus <= 201402L
12*cbaaa295SRichard Smith // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
13*cbaaa295SRichard Smith // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
14*cbaaa295SRichard Smith // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
15*cbaaa295SRichard Smith // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}}
16560a3579SRichard Smith #endif
17e6799ddaSRichard Smith 
18e6799ddaSRichard Smith // PR12717: In order to minimally diverge from the C++ standard, we do not lex
19e6799ddaSRichard Smith // 'p[+-]' as part of a pp-number unless the token starts 0x and doesn't contain
20e6799ddaSRichard Smith // an underscore.
21e6799ddaSRichard Smith double i = 0p+3; // expected-error {{invalid suffix 'p' on integer constant}}
22e6799ddaSRichard Smith #define PREFIX(x) foo ## x
23e6799ddaSRichard Smith double foo0p = 1, j = PREFIX(0p+3); // ok
24560a3579SRichard Smith double k = 0x42_amp+3;
25560a3579SRichard Smith #if __cplusplus > 201402L
26560a3579SRichard Smith // expected-error@-2 {{no matching literal operator for call to 'operator""_amp+3'}}
27560a3579SRichard Smith #elif __cplusplus >= 201103L
28560a3579SRichard Smith // expected-error@-4 {{no matching literal operator for call to 'operator""_amp'}}
29560a3579SRichard Smith #else
30560a3579SRichard Smith // expected-error@-6 {{invalid suffix '_amp' on integer constant}}
31560a3579SRichard Smith #endif
32