[Bug c++/90107] [9/10/11/12 Regression] rejects-valid on global-namespace-qualified variable declared after class definition

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 28 12:42:52 GMT 2022


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

--- Comment #5 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:940bf20cd337df5d044c59771a28d18bea595ec9

commit r11-9944-g940bf20cd337df5d044c59771a28d18bea595ec9
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Apr 27 18:17:54 2022 -0400

    c++: global-namespace-qualified var after class def [PR90107]

    Here we wrongly reject the definition of "::N::a"

      struct A;
      namespace N { extern A a; }
      struct A {} ::N::a;

    because our code to diagnose a missing ; after a class definition doesn't
    realize that :: can follow a class definition.

            PR c++/90107

    gcc/cp/ChangeLog:

            * parser.c (cp_parser_class_specifier_1): Accept :: after a class
            definition.

    gcc/testsuite/ChangeLog:

            * g++.dg/parse/qualified6.C: New test.

    (cherry picked from commit 851031b2fcd5210b96769c440db10130478d273c)


More information about the Gcc-bugs mailing list