================ @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s +// expected-no-diagnostics + +template <typename T> static void destroy() { + T t; + ++t; +} + +struct Incomplete; + +template <typename = int> struct HasD { + ~HasD() { destroy<Incomplete*>(); } +}; + +struct HasVT { + virtual ~HasVT(); +}; + +struct S : HasVT { + HasD<> v; +}; + ---------------- Fznamznon wrote:
It complains ``` gh102293.cpp:23:15: error: static assertion expression is not an integral constant expression 23 | static_assert((S{}, 1)); | ^~~~~~~~ gh102293.cpp:23:16: note: non-constexpr function '~HasD' cannot be used in a constant expression 23 | static_assert((S{}, 1)); | ^ gh102293.cpp:23:16: note: in call to 'S{}.~S()' 23 | static_assert((S{}, 1)); | ^ gh102293.cpp:12:3: note: declared here 12 | ~HasD() { destroy<Incomplete*>(); } | ^ gh102293.cpp:6:5: error: arithmetic on a pointer to an incomplete type 'Incomplete' 6 | ++t; | ^ ~ gh102293.cpp:12:13: note: in instantiation of function template specialization 'destroy<Incomplete *>' requested here 12 | ~HasD() { destroy<Incomplete*>(); } | ^ gh102293.cpp:19:8: note: in instantiation of member function 'HasD<>::~HasD' requested here 19 | struct S : HasVT { | ^ gh102293.cpp:9:8: note: forward declaration of 'Incomplete' 9 | struct Incomplete; | ^ ``` I suppose expectedly https://github.com/llvm/llvm-project/pull/102605 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits