[clang] [Clang] disallow the use of asterisks preceding constructor and destructor names (PR #122621)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 12 16:13:45 PST 2025


================
@@ -96,3 +96,13 @@ namespace PR38286 {
   template<typename> struct C; // expected-note {{non-type declaration found}}
   template<typename T> C<T>::~C() {} // expected-error {{identifier 'C' after '~' in destructor name does not name a type}}
 }
+
+namespace GH121706 {
+struct S {
+  *S();  // expected-error {{invalid constructor declaration}}
----------------
shafik wrote:

As pointed out above, we need a lot more tests. The bug report shows several other cases this applies to and they should all be enumerated in the tests. 

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


More information about the cfe-commits mailing list