[Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions

2024-04-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86885

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||4.1.2

--- Comment #2 from Andrew Pinski  ---
Hmm, the code does:
  if (TREE_CODE (decl) == FUNCTION_DECL
  && TREE_CODE (type) == FUNCTION_TYPE
  && decl_function_context (decl) == 0)
{

Which means this was supposed to be rejected (decl_function_context is supposed
to return if the context of a function is a function or not) but maybe we set
the DECL_CONTEXT of the function too late now.

The decl_function_context check has been there since constructor attribute
support was added by Jason in 1995 (r0-8721-g2c5f4139a91db2) . I am 90% sure
this worked at one point but I have no way to test anything earlier than 4.1.2
though.

[Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions

2024-04-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86885

--- Comment #1 from Andrew Pinski  ---
Created attachment 57908
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57908&action=edit
testcase

[Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions

2018-08-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86885

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-08
 Ever confirmed|0   |1