[LLVMbugs] [Bug 11179] New: Crash on unsigned short template parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 19 08:42:42 PDT 2011


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

           Summary: Crash on unsigned short template parameter
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: klimek at google.com
                CC: llvmbugs at cs.uiuc.edu


template <unsigned short T>
class X {
};

template <unsigned short T>
inline void g(X<T>& x) {
}

void f() {
  g(X<42>());
}

$CC -cc1 -fsyntax-only t.cc
t.cc:10:3: error: no matching function for call to 'g'
  g(X<42>());
  ^
Unexpected type for integer literal!
UNREACHABLE executed at
/home/klimek/local/git/llvm-1/tools/clang/lib/AST/StmtPrinter.cpp:661!
Stack dump:
0.      Program arguments: /usr/local/google/users/klimek/system/bin/clang -cc1
-fsyntax-only t.cc 
1.      t.cc:10:12: current parser token ')'
2.      t.cc:9:10: parsing function body 'f'
3.      t.cc:9:10: in compound statement ('{}')
Aborted

The problem is that for the instantiation of 'g' the template parameter becomes
an IntegerLiteral of type 'unsigned short', which is not handled in the case.

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