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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 26 07:46:29 PDT 2023


================
@@ -171,6 +171,11 @@ Attribute Changes in Clang
   automatic diagnostic to use parameters of types that the format style
   supports but that are never the result of default argument promotion, such as
   ``float``. (`#59824: <https://github.com/llvm/llvm-project/issues/59824>`_)
+- The ``constructor`` and ``destructor`` attributes now diagnose when:
+  - the priority is not between 101 and 65535, inclusive,
+  - the function it is applied to accepts arguments or has a non-void return
----------------
erichkeane wrote:

Agreed, I've convinced myself that `int` is really the only currently used example (including the CMake tests, which are particularly troublesome to me), and that we should continue supporting it without diagnostic (again, because CMake).  Everything else is either problematic due to calling-convention issues or at least not used.

So I'm OK with this being a breaking-change error except for `int`.  We've also agreed that `unsigned` makes sense as well because 'why not'.

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


More information about the cfe-commits mailing list