[LLVMbugs] [Bug 9227] New: clang emits bool template type values as '0' and '1', not 'false' and 'true'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 15 11:07:44 PST 2011


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

           Summary: clang emits bool template type values as '0' and '1',
                    not 'false' and 'true'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: llvmbugs at cs.uiuc.edu, nlewycky at google.com,
                    dgregor at apple.com


This code is invalid:

 template<bool B> struct Foo { };
 template<> struct Foo<true> { typedef int foo; };
 int test() {
   Foo<sizeof(int) == sizeof(double)>::foo i;
 }

though the technique is commonly found in compiler_assert / static_assert type
code. Clang's error is really good, but not quite perfect:

 test.cc:5:39: error: no member named 'foo' in 'Foo<0>'
   Foo<sizeof(int) == sizeof(double)>::foo i;
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 1 error generated.

That error is in 'Foo<0>'? No. It's 'Foo<false>' please.

-- 
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