[cfe-commits] r72489 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaTemplate/enum-argument.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed May 27 12:21:35 PDT 2009


Author: cornedbee
Date: Wed May 27 14:21:29 2009
New Revision: 72489

URL: http://llvm.org/viewvc/llvm-project?rev=72489&view=rev
Log:
Fix the type of a enum non-type template argument within the instantiation.

Added:
    cfe/trunk/test/SemaTemplate/enum-argument.cpp   (with props)
Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=72489&r1=72488&r2=72489&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed May 27 14:21:29 2009
@@ -1494,7 +1494,7 @@
       } 
 
       Converted->push_back(TemplateArgument(StartLoc, Value,
-                                   Context.getCanonicalType(IntegerType)));
+                      ParamType->isEnumeralType() ? ParamType : IntegerType));
     }
 
     return false;

Added: cfe/trunk/test/SemaTemplate/enum-argument.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/enum-argument.cpp?rev=72489&view=auto

==============================================================================
--- cfe/trunk/test/SemaTemplate/enum-argument.cpp (added)
+++ cfe/trunk/test/SemaTemplate/enum-argument.cpp Wed May 27 14:21:29 2009
@@ -0,0 +1,7 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+enum Enum { val = 1 };
+template <Enum v> struct C {
+  typedef C<v> Self;
+};
+template struct C<val>;

Propchange: cfe/trunk/test/SemaTemplate/enum-argument.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/SemaTemplate/enum-argument.cpp

------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/SemaTemplate/enum-argument.cpp

------------------------------------------------------------------------------
    svn:mime-type = text/plain





More information about the cfe-commits mailing list