]> granicus.if.org Git - clang/commitdiff
We do parse hexfloats in C++11; make it actually work.
authorDouglas Gregor <dgregor@apple.com>
Wed, 12 Oct 2011 18:51:02 +0000 (18:51 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 12 Oct 2011 18:51:02 +0000 (18:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141798 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Lexer.cpp
lib/Lex/LiteralSupport.cpp
test/Lexer/hexfloat.cpp

index c7a3df50bca275692458fc7346a7782dc2d68e7b..802024f79b6f92d33f109a8826c9d731a7fb90e6 100644 (file)
@@ -1358,8 +1358,7 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
   }
 
   // If we have a hex FP constant, continue.
-  if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p') &&
-      !Features.CPlusPlus0x)
+  if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p'))
     return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
 
   // Update the location of token as well as BufferPtr.
index 96550e6492bbaf78eab5d4c88d9af69cd38d158f..70183fd1a0ea42dc2089839948edef17ffb0ac6f 100644 (file)
@@ -562,9 +562,6 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
       }
       s = first_non_digit;
 
-      // In C++0x, we cannot support hexadecmial floating literals because
-      // they conflict with user-defined literals, so we warn in previous
-      // versions of C++ by default.
       if (!PP.getLangOptions().HexFloats)
         PP.Diag(TokLoc, diag::ext_hexconstant_invalid);
     } else if (saw_period) {
index 493b64e627402bee7ad2b3cdd89e2d88e51f3f78..23daa49ad2109c55682c05fd4733e775c22fb11e 100644 (file)
@@ -1,9 +1,4 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
-// XFAIL: *
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
+float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}}
 
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
-float f = 0x1p+1; // expected-warning {{incompatible with C++0x}}
-#else
-float f = 0x1p+1; // expected-warning {{invalid suffix}}
-#endif