Fix a little canonical-types issue with non-type template arguments.

Fixes PR5349. 

llvm-svn: 86052
This commit is contained in:
Douglas Gregor 2009-11-04 21:50:46 +00:00
parent f84f7105f7
commit 4d0c38ad95
2 changed files with 17 additions and 1 deletions

View File

@ -1995,7 +1995,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ArgType = Context.getCanonicalType(ArgType).getUnqualifiedType();
// Try to convert the argument to the parameter's type.
if (ParamType == ArgType) {
if (Context.hasSameType(ParamType, ArgType)) {
// Okay: no conversion necessary
} else if (IsIntegralPromotion(Arg, ArgType, ParamType) ||
!ParamType->isEnumeralType()) {

View File

@ -136,3 +136,19 @@ namespace ns {
Bar<bool(ns::Foo<int>::value)> x;
}
// PR5349
namespace ns {
enum E { k };
template <E e>
struct Baz {};
Baz<k> f1; // This works.
Baz<E(0)> f2; // This too.
Baz<static_cast<E>(0)> f3; // And this.
Baz<ns::E(0)> b1; // This doesn't work.
Baz<static_cast<ns::E>(0)> b2; // This neither.
}