[clang] [Clang][AST] Fix MS Mangle concept uneval context template instantiation crash (PR #117845)

Max Winkler via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 17:53:07 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"
----------------
MaxEW707 wrote:

> (If we wanted to, we could maybe encode this as a kind of linkage in clang/include/clang/Basic/Linkage.h . It's sort of a variation of UniqueExternal: we have an entity with external linkage, but there are restrictions on which generated code can actually refer to it. And the restriction propagates exactly the same way.)

That is a neat idea from looking at `Linkage.h` and how it is used.
I am going to merge this PR for now if that is ok to fix the regression and then look at this alternative for a future PR. That area of the codebase is still new to me so I am going to take a bit of time to spelunk and better understand it.

https://github.com/llvm/llvm-project/pull/117845


More information about the cfe-commits mailing list