diff options
author | Marek Polacek <polacek@redhat.com> | 2022-11-17 11:59:29 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-11-17 19:15:57 -0500 |
commit | 7b3b2f50953c5143d4b14b59d322d8a793f411dd (patch) | |
tree | e69fd3fbafeda0b36353ca4c7be6aacb80d3cd2e /libcpp/macro.cc | |
parent | 3f467ea953431aa6af12aaed6d32f476f7ace1e5 (diff) | |
download | gcc-7b3b2f50953c5143d4b14b59d322d8a793f411dd.zip gcc-7b3b2f50953c5143d4b14b59d322d8a793f411dd.tar.gz gcc-7b3b2f50953c5143d4b14b59d322d8a793f411dd.tar.bz2 |
c++: constinit on pointer to function [PR104066]
[dcl.constinit]: "The constinit specifier shall be applied only to
a declaration of a variable with static or thread storage duration."
Thus, this ought to be OK:
constinit void (*p)() = nullptr;
but the error message I introduced when implementing constinit was
not looking at funcdecl_p, so the code above was rejected.
Fixed thus. I'm checking constinit_p first because I think that's
far more likely to be false than funcdecl_p.
PR c++/104066
gcc/cp/ChangeLog:
* decl.cc (grokdeclarator): Check funcdecl_p before complaining
about constinit.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/constinit18.C: New test.
Diffstat (limited to 'libcpp/macro.cc')
0 files changed, 0 insertions, 0 deletions