llvm-capstone/clang/test/SemaTemplate/temp_arg_enum_printing.cpp
Pratyush Das 99d63ccff0 Add type information to integral template argument if required.
Non-comprehensive list of cases:
 * Dumping template arguments;
 * Corresponding parameter contains a deduced type;
 * Template arguments are for a DeclRefExpr that hadMultipleCandidates()

Type information is added in the form of prefixes (u8, u, U, L),
suffixes (U, L, UL, LL, ULL) or explicit casts to printed integral template
argument, if MSVC codeview mode is disabled.

Differential revision: https://reviews.llvm.org/D77598
2021-05-12 19:00:08 +00:00

25 lines
469 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<(NamedEnumNS::NamedEnum)2>()
NamedEnumNS::foo<(NamedEnum)2>();
}
} // NamedEnumNS