summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
diff options
context:
space:
mode:
authorAlexis Hunt <alercah@gmail.com>2010-01-10 23:37:56 +0000
committerAlexis Hunt <alercah@gmail.com>2010-01-10 23:37:56 +0000
commit91b78382b51bb19e4023da4ef1818f146b7018dc (patch)
tree57b662e6a2f64cecafd85c903a5e65f6ca471bd6 /clang/test/Lexer
parent504a6ae83ee2a8d9ce7e6b470efc96822be3b2ed (diff)
downloadbcm5719-llvm-91b78382b51bb19e4023da4ef1818f146b7018dc.tar.gz
bcm5719-llvm-91b78382b51bb19e4023da4ef1818f146b7018dc.zip
Do not parse hexadecimal floating point literals in C++0x mode because they are
incompatible with user-defined literals, specifically with the following form: 0x1p+1 The preprocessing-number token extends only as far as the 'p'; the '+' is not included. Previously we could get away with this extension as p was an invalid suffix, but now with user-defined literals, 'p' might well be a valid suffix and we are forced to consider it as such. This patch also adds a warning in non-0x C++ modes telling the user that this extension is incompatible with C++0x that is enabled by default (previously and with other languages, we warn only with a compliance option such as -pedantic). llvm-svn: 93135
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/hexfloat.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Lexer/hexfloat.cpp b/clang/test/Lexer/hexfloat.cpp
new file mode 100644
index 00000000000..5a62556ff61
--- /dev/null
+++ b/clang/test/Lexer/hexfloat.cpp
@@ -0,0 +1,8 @@
+//RUN: %clang_cc1 -fsyntax-only -verify
+//RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+float f = 0x1p+1; // expected-warning {{incompatible with C++0x}}
+#else
+float f = 0x1p+1; // expected-warning {{invalid suffix}}
+#endif
OpenPOWER on IntegriCloud