]> granicus.if.org Git - clang/commitdiff
Fix a bug handling hex floats in c90 mode, pointed out by Neil.
authorChris Lattner <sabre@nondot.org>
Wed, 14 Nov 2007 16:14:50 +0000 (16:14 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 14 Nov 2007 16:14:50 +0000 (16:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44120 91177308-0d34-0410-b5e6-96231b3b80d8

Lex/LiteralSupport.cpp
test/Lexer/c90.c [new file with mode: 0644]

index c0027f266cac42375cedcba7ff437199daeeb268..21ead21bfece4adafe06f2fc2ed2bae22a8ce1bf 100644 (file)
@@ -224,7 +224,7 @@ NumericLiteralParser(const char *begin, const char *end,
       }
       // A binary exponent can appear with or with a '.'. If dotted, the
       // binary exponent is required. 
-      if (*s == 'p' || *s == 'P') { 
+      if ((*s == 'p' || *s == 'P') && PP.getLangOptions().HexFloats) { 
         s++;
         saw_exponent = true;
         if (*s == '+' || *s == '-')  s++; // sign
diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c
new file mode 100644 (file)
index 0000000..84d3046
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: clang -std=c90 -fsyntax-only %s -verify
+
+enum { cast_hex = (long) (
+      0x0p-1   /* expected-error {{invalid suffix 'p' on integer constant}} */
+     ) };