public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place
@ 2020-06-24 19:51 drewb at valvesoftware dot com
  2020-06-25 13:09 ` [Bug c++/95883] " ttimo at valvesoftware dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: drewb at valvesoftware dot com @ 2020-06-24 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95883
           Summary: Attributes on lambdas appear to be parsed in the wrong
                    place
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drewb at valvesoftware dot com
  Target Milestone: ---

Created attachment 48782
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48782&action=edit
Artificial source test case

In 90333 there's a discussion of where attributes on lambdas should be
processed.  In 8.3 they were handled after the declarator but that regressed in
9.  90333 says that it was fixed to work properly after the declarator and that
they also added support for attributes before the declarator.  However in
testing against 9.3 attributes after the declarator do not work so it does not
look like the fix is working.

cppreference says that lambda attributes should come after the declarator. 
Testing with godbolt it looks like attributes after the declarator are the
common case (for example clang works on the test case and fails with attributes
before the declarator).

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

* [Bug c++/95883] Attributes on lambdas appear to be parsed in the wrong place
  2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
@ 2020-06-25 13:09 ` ttimo at valvesoftware dot com
  2020-06-25 23:32 ` ttimo at valvesoftware dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ttimo at valvesoftware dot com @ 2020-06-25 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Timothee Besset <ttimo at valvesoftware dot com> ---
Known to fail: 9.3, 10.0

Putting the full link to the original bug so it gets linked:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90333

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

* [Bug c++/95883] Attributes on lambdas appear to be parsed in the wrong place
  2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
  2020-06-25 13:09 ` [Bug c++/95883] " ttimo at valvesoftware dot com
@ 2020-06-25 23:32 ` ttimo at valvesoftware dot com
  2020-06-29 21:12 ` patrick.a.moran at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ttimo at valvesoftware dot com @ 2020-06-25 23:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Timothee Besset <ttimo at valvesoftware dot com> ---
Created attachment 48787
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48787&action=edit
Add a parse for gnu attributes before CPP_DEREF, fixes regression

Proposed patch. Add a parsing for gnu attributes before the CPP_DEREF (->)
parsing.

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

* [Bug c++/95883] Attributes on lambdas appear to be parsed in the wrong place
  2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
  2020-06-25 13:09 ` [Bug c++/95883] " ttimo at valvesoftware dot com
  2020-06-25 23:32 ` ttimo at valvesoftware dot com
@ 2020-06-29 21:12 ` patrick.a.moran at gmail dot com
  2020-06-29 21:15 ` ttimo at valvesoftware dot com
  2021-02-26  4:15 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: patrick.a.moran at gmail dot com @ 2020-06-29 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Moran <patrick.a.moran at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |patrick.a.moran at gmail dot com

--- Comment #3 from Patrick Moran <patrick.a.moran at gmail dot com> ---
My argument in favor of restoring the pre-9-series behavior is that of compiler
portability.  When you have a lambda with a trailing return type that you want
to mark with __attribute__((always_inline)) there's now one syntax that works
with GCCs before 9.1 and with clang (who is matching gcc), and another syntax
that works with GCCs after 9.3, but not with any GCC before 9.3 or any version
of clang.  If you want to write code that works with GCC 8.3 and 10.1, or with
both GCC 10.1 and any clang, then you have to write macros to move the
attributes around.

Whereas if the patch in this bug (or another like it), then at least the one
existing codebase I'm working on won't have to add a macro layer to be able to
support lambdas across our range of supported compilers.

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

* [Bug c++/95883] Attributes on lambdas appear to be parsed in the wrong place
  2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
                   ` (2 preceding siblings ...)
  2020-06-29 21:12 ` patrick.a.moran at gmail dot com
@ 2020-06-29 21:15 ` ttimo at valvesoftware dot com
  2021-02-26  4:15 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ttimo at valvesoftware dot com @ 2020-06-29 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Timothee Besset <ttimo at valvesoftware dot com> ---
We are in the same situation; we are assessing a move to a newer gcc but we
need to maintain compatibility with older gcc, at least for the time being. We
would like to avoid having to use macros for all of this.

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

* [Bug c++/95883] Attributes on lambdas appear to be parsed in the wrong place
  2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
                   ` (3 preceding siblings ...)
  2020-06-29 21:15 ` ttimo at valvesoftware dot com
@ 2021-02-26  4:15 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-26  4:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Let's resolve this in 90333.

*** This bug has been marked as a duplicate of bug 90333 ***

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

end of thread, other threads:[~2021-02-26  4:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 19:51 [Bug c++/95883] New: Attributes on lambdas appear to be parsed in the wrong place drewb at valvesoftware dot com
2020-06-25 13:09 ` [Bug c++/95883] " ttimo at valvesoftware dot com
2020-06-25 23:32 ` ttimo at valvesoftware dot com
2020-06-29 21:12 ` patrick.a.moran at gmail dot com
2020-06-29 21:15 ` ttimo at valvesoftware dot com
2021-02-26  4:15 ` jason 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).