]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix ICE with invalid requires-expression [PR100055]
authorMarek Polacek <polacek@redhat.com>
Thu, 22 Apr 2021 21:32:01 +0000 (17:32 -0400)
committerMarek Polacek <polacek@redhat.com>
Mon, 3 May 2021 16:39:43 +0000 (12:39 -0400)
commitc9b6890d0b6aa030b307fdb620f8c53ed59ca3b5
tree92f1c916e30e79d3b0fce9a5d9b2fcf246578f26
parent6252e35cf5cea9a30a57ceffbc7a9f3160900a45
c++: Fix ICE with invalid requires-expression [PR100055]

This fixes a crash on invalid requires-expression: in this test,
current_template_parms is null so accessing TEMPLATE_PARMS_CONSTRAINTS
is going to fail.  So don't crash, but make sure we've complained
already.

gcc/cp/ChangeLog:

PR c++/100055
* decl.c (grokfndecl): Check current_template_parms.

gcc/testsuite/ChangeLog:

PR c++/100055
* g++.dg/concepts/diagnostic18.C: New test.
gcc/cp/decl.c
gcc/testsuite/g++.dg/concepts/diagnostic18.C [new file with mode: 0644]