llvm-project/clang/test/SemaTemplate/temp_arg_enum_printing.cpp
Paul Robinson f183848ace [AST] Incorrectly qualified unscoped enumeration as template actual parameter.
An unscoped enumeration used as template argument, should not have any
qualified information about its enclosing scope, as its visibility is
global.

In the case of scoped enumerations, they must include information
about their enclosing scope.

Patch by Carlos Alberto Enciso!

Differential Revision: https://reviews.llvm.org/D39239

llvm-svn: 321312
2017-12-21 21:47:22 +00:00

25 lines
445 B
C++

// RUN: %clang_cc1 -fsyntax-only -ast-print %s | FileCheck %s
namespace NamedEnumNS
{
enum NamedEnum
{
Val0,
Val1
};
template <NamedEnum E>
void foo();
void test() {
// CHECK: template<> void foo<NamedEnumNS::Val0>()
NamedEnumNS::foo<Val0>();
// CHECK: template<> void foo<NamedEnumNS::Val1>()
NamedEnumNS::foo<(NamedEnum)1>();
// CHECK: template<> void foo<2>()
NamedEnumNS::foo<(NamedEnum)2>();
}
} // NamedEnumNS