[LLVMbugs] [Bug 6982] New: Poor diagnostic for non-template used as template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 29 17:48:33 PDT 2010


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

           Summary: Poor diagnostic for non-template used as template
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: me22.ca at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=4776)
 --> (http://llvm.org/bugs/attachment.cgi?id=4776)
Source file (as pasted in description)

I came across this from a pasto on my part.  Given this code:

    template <int UnitBits>
    struct big_unit_big_bit {};
    typedef big_unit_big_bit<8> big_octet_big_bit;

    template <typename Endianness>
    struct imploder;
    template <int UnitBits>
    struct imploder<big_octet_big_bit<UnitBits> > {};

I get the following from clang++:

    clang.cc:9:34: error: expected '>'
    struct imploder<big_octet_big_bit<UnitBits> > {};
                                     ^
    clang.cc:9:1: error: declaration of anonymous struct must be a definition
    struct imploder<big_octet_big_bit<UnitBits> > {};
    ^
    clang.cc:9:1: error: declaration does not declare anything
    struct imploder<big_octet_big_bit<UnitBits> > {};
    ^
    3 diagnostics generated.

For comparison, g++ (I tried 3.4, 4.1, 4.3, and 4.4) gives this:

    clang.cc:9: error: ‘big_octet_big_bit’ is not a template
    clang.cc:9: error: template parameters not used in partial specialization:
    clang.cc:9: error:         ‘UnitBits’

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