From: Sebastian Redl Date: Wed, 27 May 2009 19:21:29 +0000 (+0000) Subject: Fix the type of a enum non-type template argument within the instantiation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=599fe7ccc0cbfe761b54039fcc2a7c62d7f84934;p=clang Fix the type of a enum non-type template argument within the instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72489 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 97eca48b9f..b15ce295ea 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1494,7 +1494,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, } Converted->push_back(TemplateArgument(StartLoc, Value, - Context.getCanonicalType(IntegerType))); + ParamType->isEnumeralType() ? ParamType : IntegerType)); } return false; diff --git a/test/SemaTemplate/enum-argument.cpp b/test/SemaTemplate/enum-argument.cpp new file mode 100644 index 0000000000..101a1d0cd9 --- /dev/null +++ b/test/SemaTemplate/enum-argument.cpp @@ -0,0 +1,7 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +enum Enum { val = 1 }; +template struct C { + typedef C Self; +}; +template struct C;