public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100752] New: [11/12 Regression]
@ 2021-05-25  9:01 redi at gcc dot gnu.org
  2021-05-25  9:03 ` [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-25  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100752
           Summary: [11/12 Regression]
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

As noted in Bug 52869 comment 20, this has started to fail:

struct S
{
    void f() noexcept {}
    S &g() noexcept(noexcept(f())) { f(); return *this; }
};

noex.C:4:32: error: cannot call member function ‘void S::f()’ without object
    4 |     S &g() noexcept(noexcept(f())) { f(); return *this; }
      |                                ^


It started with r11-289:

     c++: Use of 'this' in parameter declaration [PR90748]

    We were incorrectly accepting the use of 'this' at parse time and then
    crashing when we tried to instantiate it.  It is invalid because 'this' is
    not in scope until after the function-cv-quals.  So let's hoist setting
    current_class_ptr up from cp_parser_late_return_type_opt into
    cp_parser_direct_declarator where it can work for noexcept as well.


            PR c++/90748
            * parser.c (inject_parm_decls): Set current_class_ptr here.
            (cp_parser_direct_declarator): And here.
            (cp_parser_late_return_type_opt): Not here.
            (cp_parser_noexcept_specification_opt): Nor here.
            (cp_parser_exception_specification_opt)
            (cp_parser_late_noexcept_specifier): Remove unneeded parameters.

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
@ 2021-05-25  9:03 ` redi at gcc dot gnu.org
  2021-05-25  9:14 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-25  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0
   Target Milestone|---                         |11.2
      Known to fail|                            |11.1.0, 12.0

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
  2021-05-25  9:03 ` [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object redi at gcc dot gnu.org
@ 2021-05-25  9:14 ` rguenth at gcc dot gnu.org
  2021-05-26 19:24 ` jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-25  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
  2021-05-25  9:03 ` [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object redi at gcc dot gnu.org
  2021-05-25  9:14 ` rguenth at gcc dot gnu.org
@ 2021-05-26 19:24 ` jason at gcc dot gnu.org
  2021-05-26 19:35 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-26 19:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-05-26

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-26 19:24 ` jason at gcc dot gnu.org
@ 2021-05-26 19:35 ` jason at gcc dot gnu.org
  2021-05-26 19:35 ` jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-26 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|jason at gcc dot gnu.org           |unassigned at gcc dot gnu.org
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
This is happening because we aren't deferring the parse of this noexcept the
way we're supposed to.  Marek?

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-26 19:35 ` jason at gcc dot gnu.org
@ 2021-05-26 19:35 ` jason at gcc dot gnu.org
  2021-05-26 19:40 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-26 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-05-26 19:35 ` jason at gcc dot gnu.org
@ 2021-05-26 19:40 ` mpolacek at gcc dot gnu.org
  2021-06-08 21:10 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-05-26 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine then.

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-05-26 19:40 ` mpolacek at gcc dot gnu.org
@ 2021-06-08 21:10 ` mpolacek at gcc dot gnu.org
  2021-06-08 21:12 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-08 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Duh, we don't defer parsing of noexcept for any ptr-operator, like

struct S {
  int& f() noexcept(noexcept(i));
  int i;
};

Awkward, but the fix should be simple.

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-06-08 21:10 ` mpolacek at gcc dot gnu.org
@ 2021-06-08 21:12 ` jason at gcc dot gnu.org
  2021-06-26  0:12 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-08 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
As I mentioned on IRC, it seems like this may just be a matter of properly
passing down flags/member_p in the recursive call to cp_parser_declarator.

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

* [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-06-08 21:12 ` jason at gcc dot gnu.org
@ 2021-06-26  0:12 ` cvs-commit at gcc dot gnu.org
  2021-06-26  0:12 ` [Bug c++/100752] [11 " mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-26  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:f9c80eb12c58126a94ad869380af5b88b752c06f

commit r12-1822-gf9c80eb12c58126a94ad869380af5b88b752c06f
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jun 8 17:44:13 2021 -0400

    c++: Failure to delay noexcept parsing with ptr-operator [PR100752]

    We weren't passing 'flags' to the recursive call to cp_parser_declarator
    in the ptr-operator case and as an effect, delayed parsing of noexcept
    didn't work as advertised.  The following change passes more than just
    CP_PARSER_FLAGS_DELAY_NOEXCEPT but that doesn't seem to break anything.

    I'm now also passing member_p and static_p, as a consequence, two tests
    needed small tweaks.

            PR c++/100752

    gcc/cp/ChangeLog:

            * parser.c (cp_parser_declarator): Pass flags down to
            cp_parser_declarator.  Also pass static_p/member_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept69.C: New test.
            * g++.dg/parse/saved1.C: Adjust dg-error.
            * g++.dg/template/crash50.C: Likewise.

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

* [Bug c++/100752] [11 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-06-26  0:12 ` cvs-commit at gcc dot gnu.org
@ 2021-06-26  0:12 ` mpolacek at gcc dot gnu.org
  2021-06-29 13:18 ` cvs-commit at gcc dot gnu.org
  2021-06-29 13:19 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-26  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] error:   |[11 Regression] error:
                   |cannot call member function |cannot call member function
                   |‘void S::f()’ without       |‘void S::f()’ without
                   |object                      |object

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/100752] [11 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-06-26  0:12 ` [Bug c++/100752] [11 " mpolacek at gcc dot gnu.org
@ 2021-06-29 13:18 ` cvs-commit at gcc dot gnu.org
  2021-06-29 13:19 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-29 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:2cf8d3fc05737684a16fa080b0c0d24048da782b

commit r11-8662-g2cf8d3fc05737684a16fa080b0c0d24048da782b
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jun 8 17:44:13 2021 -0400

    c++: Failure to delay noexcept parsing with ptr-operator [PR100752]

    We weren't passing 'flags' to the recursive call to cp_parser_declarator
    in the ptr-operator case and as an effect, delayed parsing of noexcept
    didn't work as advertised.  The following change passes more than just
    CP_PARSER_FLAGS_DELAY_NOEXCEPT but that doesn't seem to break anything.

    I'm now also passing member_p and static_p, as a consequence, two tests
    needed small tweaks.

            PR c++/100752

    gcc/cp/ChangeLog:

            * parser.c (cp_parser_declarator): Pass flags down to
            cp_parser_declarator.  Also pass static_p/member_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept69.C: New test.
            * g++.dg/parse/saved1.C: Adjust dg-error.
            * g++.dg/template/crash50.C: Likewise.

    (cherry picked from commit f9c80eb12c58126a94ad869380af5b88b752c06f)

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

* [Bug c++/100752] [11 Regression] error: cannot call member function ‘void S::f()’ without object
  2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-06-29 13:18 ` cvs-commit at gcc dot gnu.org
@ 2021-06-29 13:19 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-29 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-06-29 13:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  9:01 [Bug c++/100752] New: [11/12 Regression] redi at gcc dot gnu.org
2021-05-25  9:03 ` [Bug c++/100752] [11/12 Regression] error: cannot call member function ‘void S::f()’ without object redi at gcc dot gnu.org
2021-05-25  9:14 ` rguenth at gcc dot gnu.org
2021-05-26 19:24 ` jason at gcc dot gnu.org
2021-05-26 19:35 ` jason at gcc dot gnu.org
2021-05-26 19:35 ` jason at gcc dot gnu.org
2021-05-26 19:40 ` mpolacek at gcc dot gnu.org
2021-06-08 21:10 ` mpolacek at gcc dot gnu.org
2021-06-08 21:12 ` jason at gcc dot gnu.org
2021-06-26  0:12 ` cvs-commit at gcc dot gnu.org
2021-06-26  0:12 ` [Bug c++/100752] [11 " mpolacek at gcc dot gnu.org
2021-06-29 13:18 ` cvs-commit at gcc dot gnu.org
2021-06-29 13:19 ` 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).