[clang] [Clang][AST] Fix MS Mangle concept uneval context template instantiation crash (PR #117845)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 16:03:51 PST 2024
================
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -std=c++20 -fms-compatibility -fms-compatibility-version=19.33 -emit-llvm %s -o - -triple=x86_64-windows-msvc | FileCheck %s
+
+template <typename T>
+concept C = requires
+{
+ { T::test([](){}) };
+};
+
+template<typename T>
+struct Widget {};
+
+template <C T>
+struct Widget<T> {};
+
+struct Baz
+{
+ template<typename F>
+ static constexpr decltype(auto) test(F&&) {}
+};
+
+void test()
+{
+ Widget<Baz> w;
+}
+// CHECK: @"?test@@YAXXZ"
----------------
efriedma-quic wrote:
Once we get to CodeGen, the method looks like a regular method, except for the fact that one of the template arguments is a class defined inside a concept instantiation. And CodeGen doesn't have any way to check for "is a template argument a class defined inside a concept". So, like all other methods, we stick it into DeferredDecls. And the key for the DeferredDecls map is the mangled name.
We end up trying to mangle a TemplateTypeParmType because we stick the instantiated class into the scope of an uninstantiated class template.
So no, we don't actually need to mangle it, but there's currently no way for CodeGen to check for this situation.
https://github.com/llvm/llvm-project/pull/117845
More information about the cfe-commits
mailing list