public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template
@ 2021-04-08 19:11 mpolacek at gcc dot gnu.org
  2021-04-08 19:12 ` [Bug c++/99980] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-08 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99980
           Summary: Delayed parsing of noexcept doesn't work in member
                    function template
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

We should accept this:

struct S {
  template<typename T>
  void f(T) noexcept(B);
  static constexpr bool B = true;
};

but we don't; we need something like

--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -30526,7 +30526,8 @@ cp_parser_single_declaration (cp_parser* parser,
      || decl_specifiers.type != error_mark_node))
     {
       decl = cp_parser_init_declarator (parser,
-                   CP_PARSER_FLAGS_TYPENAME_OPTIONAL,
+                   CP_PARSER_FLAGS_TYPENAME_OPTIONAL
+                   | CP_PARSER_FLAGS_DELAY_NOEXCEPT,
                        &decl_specifiers,
                        checks,
                        /*function_definition_allowed_p=*/true,

(but not when friend_p).  Found while looking into
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99806#c3.

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

* [Bug c++/99980] Delayed parsing of noexcept doesn't work in member function template
  2021-04-08 19:11 [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template mpolacek at gcc dot gnu.org
@ 2021-04-08 19:12 ` mpolacek at gcc dot gnu.org
  2021-12-16 22:40 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-08 19:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2021-04-08

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Not a regression.  Mine for GCC 12.

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

* [Bug c++/99980] Delayed parsing of noexcept doesn't work in member function template
  2021-04-08 19:11 [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template mpolacek at gcc dot gnu.org
  2021-04-08 19:12 ` [Bug c++/99980] " mpolacek at gcc dot gnu.org
@ 2021-12-16 22:40 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:46 ` mpolacek at gcc dot gnu.org
  2023-12-27 19:51 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:06041b2c67a5d4d0941c53990f0438a309703ed0

commit r12-6025-g06041b2c67a5d4d0941c53990f0438a309703ed0
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Dec 15 17:41:53 2021 -0500

    c++: delayed noexcept in member function template [PR99980]

    Some time ago I noticed that we don't properly delay parsing of
    noexcept for member function templates.  This patch fixes that.

    It didn't work because even though we set CP_PARSER_FLAGS_DELAY_NOEXCEPT
    in cp_parser_member_declaration, member template declarations take
    a different path: we call cp_parser_template_declaration and return
    prior to setting the flag.

            PR c++/99980

    gcc/cp/ChangeLog:

            * parser.c (cp_parser_single_declaration): Maybe pass
            CP_PARSER_FLAGS_DELAY_NOEXCEPT down to cp_parser_init_declarator.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept71.C: New test.

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

* [Bug c++/99980] Delayed parsing of noexcept doesn't work in member function template
  2021-04-08 19:11 [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template mpolacek at gcc dot gnu.org
  2021-04-08 19:12 ` [Bug c++/99980] " mpolacek at gcc dot gnu.org
  2021-12-16 22:40 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:46 ` mpolacek at gcc dot gnu.org
  2023-12-27 19:51 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-16 22:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug c++/99980] Delayed parsing of noexcept doesn't work in member function template
  2021-04-08 19:11 [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-12-16 22:46 ` mpolacek at gcc dot gnu.org
@ 2023-12-27 19:51 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-27 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

end of thread, other threads:[~2023-12-27 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 19:11 [Bug c++/99980] New: Delayed parsing of noexcept doesn't work in member function template mpolacek at gcc dot gnu.org
2021-04-08 19:12 ` [Bug c++/99980] " mpolacek at gcc dot gnu.org
2021-12-16 22:40 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:46 ` mpolacek at gcc dot gnu.org
2023-12-27 19:51 ` 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).