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.

Reply via email to