public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98441] New: member function pointer incorrectly parsed as having trailing return type
@ 2020-12-25  0:24 daniel.santos at pobox dot com
  2020-12-25  0:29 ` [Bug c++/98441] " daniel.santos at pobox dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: daniel.santos at pobox dot com @ 2020-12-25  0:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98441
           Summary: member function pointer incorrectly parsed as having
                    trailing return type
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.santos at pobox dot com
  Target Milestone: ---

When declaring pointer to a member function pointer using atuo& as the
function's return type, we get a bad parse:

struct a {
    int& mfn();
};

void fn()
{
    int&  (a::*myvar1)(void) = &a::mfn;
    auto& (a::*myvar2)(void) = &a::mfn;
    auto  (a::*myvar3)(void) = &a::mfn;
}

Results in:

<source>: In function 'void fn()':
<source>:8:5: error: 'myvar2' function with trailing return type has 'auto&' as
its type rather than plain 'auto'
    8 |     auto& (a::*myvar2)(void) = &a::mfn;
      |     ^~~~

However, it builds on GCC 9 and is alleged to build on MSVC.  The above example
is simplified from the original sources:

https://github.com/freeorion/freeorion/blob/v0.4.10.1/python/UniverseWrapper.cpp#L193

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

end of thread, other threads:[~2021-01-07 21:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25  0:24 [Bug c++/98441] New: member function pointer incorrectly parsed as having trailing return type daniel.santos at pobox dot com
2020-12-25  0:29 ` [Bug c++/98441] " daniel.santos at pobox dot com
2020-12-27 20:23 ` [Bug c++/98441] [10/11 Regression] " redi at gcc dot gnu.org
2020-12-27 20:26 ` [Bug c++/98441] [11 " redi at gcc dot gnu.org
2020-12-29  9:07 ` daniel.santos at pobox dot com
2020-12-29 10:17 ` redi at gcc dot gnu.org
2020-12-29 18:19 ` daniel.santos at pobox dot com
2020-12-31 19:17 ` mpolacek at gcc dot gnu.org
2021-01-05 23:11 ` mpolacek at gcc dot gnu.org
2021-01-07 21:20 ` cvs-commit at gcc dot gnu.org
2021-01-07 21:23 ` mpolacek 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).