[Bug c++/126323] [13/14/15/16/17 Regression] ICE when parsing #pragma GCC ivdep or unroll(0) or novector inside a class definition before a for statement

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126323

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <[email protected]>:

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

commit r17-2717-gcd453025faf5ab3ada2428e5fc372d9a6328c9cb
Author: Odysseas Georgoudis <[email protected]>
Date:   Fri Jul 24 15:17:32 2026 -0400

    c++: Fix ICE with loop pragmas at class scope [PR126323]

    cp_parser_pragma rejected GCC loop pragmas at namespace scope, but not
    at class scope.  Consequently, it attempted to parse the following loop
    as a statement while in a member-declaration context, leading to an ICE
    when processing the loop initializer.

    Accept these pragmas only in statement contexts.

    gcc/cp/ChangeLog:

            PR c++/126323
            * parser.cc (cp_parser_pragma): Reject GCC loop pragmas outside
            statement contexts.

    gcc/testsuite/ChangeLog:

            PR c++/126323
            * g++.dg/parse/pr126323.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.