================ @@ -2218,6 +2219,24 @@ printTo(raw_ostream &OS, ArrayRef<TA> Args, const PrintingPolicy &Policy, } else { if (!FirstArg) OS << Comma; + + if (Policy.UseClassForTemplateArgument && + Argument.getKind() == TemplateArgument::Type && + !Argument.getAsType()->isBuiltinType()) { + const Type *Ty = Argument.getAsType().getTypePtr(); + const char *kw; + if (Ty->isStructureType()) + kw = "struct "; + else if (Ty->isClassType()) + kw = "class "; + else if (Ty->isUnionType()) + kw = "union "; + else if (Ty->isEnumeralType()) + kw = "enum "; + else + llvm_unreachable("argument type not expected"); ---------------- AaronBallman wrote:
This sure seems reachable to me! Consider: ``` template <class T> class TestClass { public: TestClass() { constexpr const char *function = __FUNCTION__; constexpr const char *func = __func__; puts(function); puts(func); } }; class S {}; } void instantiate() { test_func::TestClass<test_func::S *>{}; } ``` which I believe will crash. https://github.com/llvm/llvm-project/pull/67592 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits