================
@@ -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
----------------
AaronBallman wrote:

I was on the fence about diagnosing the return value, but ultimately decided it 
was a type error to have a non-void return value because of calling 
conventions. e.g., 
```
struct S {
  long double ld1, ld2;
};

__attribute__((constructor))
struct S func(void) {
  return (struct S){ 1.0l, 2.0l };
}
```
where the returned struct is actually returned via a hidden pointer passed to 
the function. I don't want to play whack-a-mole with signature checking unless 
there's some compelling use case in the wild where people actually are using 
these functions to obtain a value outside of ctor/dtor calls.

https://github.com/llvm/llvm-project/pull/67360
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to