]> git.ipfire.org Git - people/ms/gcc.git/commit
c++: non-static member, array bound, sizeof [PR93314]
authorJason Merrill <jason@redhat.com>
Wed, 14 Apr 2021 13:30:05 +0000 (09:30 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 14 Apr 2021 17:47:46 +0000 (13:47 -0400)
commit9b53edc796d284b6adec7f2996772dbddf4c341e
tree25e585b64c912f57d39957ed6368d4de3bf97b1d
parentf99f64f69db49ce6343d79a39eab28dcc6b91865
c++: non-static member, array bound, sizeof [PR93314]

N2253 allowed referring to non-static data members without an object in
unevaluated operands like that of sizeof, but in a constant-expression
context like an array bound or template argument within such an unevaluated
operand we do actually need a value, so that permission cannot apply.

gcc/cp/ChangeLog:

PR c++/93314
* semantics.c (finish_id_expression_1): Clear cp_unevaluated_operand
for a non-static data member in a constant-expression.

gcc/testsuite/ChangeLog:

PR c++/93314
* g++.dg/parse/uneval1.C: New test.
gcc/cp/semantics.c
gcc/testsuite/g++.dg/parse/uneval1.C [new file with mode: 0644]