]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix error recovery after export keyword [PR121832]
authorNathaniel Shead <nathanieloshead@gmail.com>
Fri, 12 Sep 2025 13:26:20 +0000 (23:26 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Sun, 1 Feb 2026 01:10:27 +0000 (12:10 +1100)
commitff7d7898bb40d4bc72ad157d48eaa42fbe022512
tree72c6c18f52bf000fb3a34f87f7a2d7a721e7e5b9
parent56d85ab2a552db247dda7310ed68377cdf42c7bc
c++: Fix error recovery after export keyword [PR121832]

When we enter cp_parser_explicit_template_declaration with the following
tokens being 'template <>', we never parse a parameter list and so with
-fconcepts we crash dereferencing a null pointer.  This can currently
only happen after a non-modules 'export' declaration, as all other paths
check early for this case.

PR c++/121832

gcc/cp/ChangeLog:

* parser.cc (cp_parser_explicit_template_declaration): Check for
null.

gcc/testsuite/ChangeLog:

* g++.dg/concepts/pr121832.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/parser.cc
gcc/testsuite/g++.dg/concepts/pr121832.C [new file with mode: 0644]