[LLVMbugs] [Bug 12717] New: Incorrect lexing of pp-numbers in C++11 due to hexfloat extension

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 1 11:26:21 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12717

             Bug #: 12717
           Summary: Incorrect lexing of pp-numbers in C++11 due to
                    hexfloat extension
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang support C99 hexadecimal literals as an extension in its C++ modes. This
is *almost* a conforming extension in C++98 mode, but it's far from being one
in C++11 mode. For instance, in C++98:

#define PREFIX(x) foo ## x
void f() {
  int PREFIX(1p);
  int PREFIX(2p) = PREFIX(1p+5); // incorrect error: foo1p+5 is not a pp-token
}

In the rules of C++, "1p+5" is three tokens, not one.

In C++11, this goes wrong in much less contrived situations:

Units<Amp> operator"" _amp(unsigned long long d);
int k = 4_amp+1; // incorrect error: no literal operator "" _amp+1

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list