From 599fe7ccc0cbfe761b54039fcc2a7c62d7f84934 Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Wed, 27 May 2009 19:21:29 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaTemplate.cpp | 2 +- test/SemaTemplate/enum-argument.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/SemaTemplate/enum-argument.cpp 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; -- 2.50.1