File: hexfloat.cpp

package info (click to toggle)
llvm-toolchain-3.9 1%3A3.9.1-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 441,060 kB
  • ctags: 428,777
  • sloc: cpp: 2,546,577; ansic: 538,318; asm: 119,677; objc: 103,316; python: 102,148; sh: 27,847; pascal: 5,626; ml: 5,510; perl: 5,293; lisp: 4,801; makefile: 2,177; xml: 686; cs: 362; php: 212; csh: 117
file content (31 lines) | stat: -rw-r--r-- 1,438 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s
// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s
double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}}

float f = 0x1p+1;
double d = 0x.2p2;
float g = 0x1.2p2;
double h = 0x1.p2;
#if __cplusplus <= 201402L
// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}}
#endif

// PR12717: In order to minimally diverge from the C++ standard, we do not lex
// 'p[+-]' as part of a pp-number unless the token starts 0x and doesn't contain
// an underscore.
double i = 0p+3; // expected-error {{invalid suffix 'p' on integer constant}}
#define PREFIX(x) foo ## x
double foo0p = 1, j = PREFIX(0p+3); // ok
double k = 0x42_amp+3;
#if __cplusplus > 201402L
// expected-error@-2 {{no matching literal operator for call to 'operator""_amp+3'}}
#elif __cplusplus >= 201103L
// expected-error@-4 {{no matching literal operator for call to 'operator""_amp'}}
#else
// expected-error@-6 {{invalid suffix '_amp' on integer constant}}
#endif