https://github.com/nakasan617 updated https://github.com/llvm/llvm-project/pull/227936
>From d3f0185286646b70e6c15f06f6cbbe9c05d3dd71 Mon Sep 17 00:00:00 2001 From: Yuta Nakamura <[email protected]> Date: Thu, 1 Oct 2026 11:29:18 +0900 Subject: [PATCH 1/3] [Clang] Add regression test for #175934 Taking the address of a static data member of a class template inside `decltype` used to make the field type dependent, which crashed record layout with "should not see dependent types here". This was fixed by #208012, which made such expressions value-instantiation-dependent rather than value-dependent, but no test was added for this case. Fixes #175934 Co-Authored-By: Claude Opus 5.5 <[email protected]> --- clang/test/SemaTemplate/dependent-expr.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clang/test/SemaTemplate/dependent-expr.cpp b/clang/test/SemaTemplate/dependent-expr.cpp index ce210d9b74f6d..d52b9ed4bee50 100644 --- a/clang/test/SemaTemplate/dependent-expr.cpp +++ b/clang/test/SemaTemplate/dependent-expr.cpp @@ -180,3 +180,17 @@ class Builder { static constexpr auto Val = JoinStringViews<Equal>; }; } // namespace PR65153 + +namespace GH175934 { +template <class T> +struct Y { + static const int e = 1; + decltype(&e) g; +}; + +// Taking the address of a static data member is value-dependent but not +// type-dependent, so the field type must be concrete by the time the layout +// of Y<int> is computed. +void f() { Y<int> y; } +static_assert(__is_same(decltype(Y<int>::g), const int *), ""); +} // namespace GH175934 >From d0491b20563f5714a8db7a6d2c1b7d86700bab65 Mon Sep 17 00:00:00 2001 From: Yuta Nakamura <[email protected]> Date: Thu, 1 Oct 2026 11:49:48 +0900 Subject: [PATCH 2/3] Remove comment from test Co-Authored-By: Claude Opus 5.5 <[email protected]> --- clang/test/SemaTemplate/dependent-expr.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/clang/test/SemaTemplate/dependent-expr.cpp b/clang/test/SemaTemplate/dependent-expr.cpp index d52b9ed4bee50..1a00f78de9a99 100644 --- a/clang/test/SemaTemplate/dependent-expr.cpp +++ b/clang/test/SemaTemplate/dependent-expr.cpp @@ -188,9 +188,6 @@ struct Y { decltype(&e) g; }; -// Taking the address of a static data member is value-dependent but not -// type-dependent, so the field type must be concrete by the time the layout -// of Y<int> is computed. void f() { Y<int> y; } static_assert(__is_same(decltype(Y<int>::g), const int *), ""); } // namespace GH175934 >From fa9b0bb5b0f523a87c7ae47520b9bd2901ff528b Mon Sep 17 00:00:00 2001 From: Yuta Nakamura <[email protected]> Date: Thu, 1 Oct 2026 12:12:13 +0900 Subject: [PATCH 3/3] Remove static_assert from test Co-Authored-By: Claude Opus 5.5 <[email protected]> --- clang/test/SemaTemplate/dependent-expr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/SemaTemplate/dependent-expr.cpp b/clang/test/SemaTemplate/dependent-expr.cpp index 1a00f78de9a99..667411a8e66b7 100644 --- a/clang/test/SemaTemplate/dependent-expr.cpp +++ b/clang/test/SemaTemplate/dependent-expr.cpp @@ -189,5 +189,4 @@ struct Y { }; void f() { Y<int> y; } -static_assert(__is_same(decltype(Y<int>::g), const int *), ""); } // namespace GH175934 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
