[clang] Diagnose problematic uses of constructor/destructor attribute (PR #67360)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 15:51:37 PDT 2023


================
@@ -3176,6 +3178,11 @@ def err_alignas_underaligned : Error<
   "requested alignment is less than minimum alignment of %1 for type %0">;
 def warn_aligned_attr_underaligned : Warning<err_alignas_underaligned.Summary>,
   InGroup<IgnoredAttributes>;
+def err_ctor_dtor_attr_on_non_void_func : Error<
+  "%0 attribute can only be applied to a function which accepts no arguments "
+  "and has a 'void' or 'int' return type">;
----------------
nickdesaulniers wrote:

ah, perhaps what I'm thinking of is that we aught to emit a similar diagnostic for the return type of those functions.

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


More information about the cfe-commits mailing list