public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions
       [not found] <bug-86885-4@http.gcc.gnu.org/bugzilla/>
@ 2024-04-09  5:01 ` pinskia at gcc dot gnu.org
  2024-04-09  5:14 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09  5:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86885

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions
       [not found] <bug-86885-4@http.gcc.gnu.org/bugzilla/>
  2024-04-09  5:01 ` [Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions pinskia at gcc dot gnu.org
@ 2024-04-09  5:14 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-09  5:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86885

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.1.2

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-09  5:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86885-4@http.gcc.gnu.org/bugzilla/>
2024-04-09  5:01 ` [Bug c/86885] gcc erroneously allows constructor/destructor attributes on nested functions pinskia at gcc dot gnu.org
2024-04-09  5:14 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).