Fix template/ref1.C, nontype15.C, addr-builtin1.C with -std=c++1z.
* parser.c (cp_parser_template_argument): Handle references in C++1z mode. * constexpr.c (potential_constant_expression_1): Don't error about TREE_THIS_VOLATILE on declarations. [COMPONENT_REF]: Don't consider the object if we're dealing with an overloaded function. From-SVN: r231351
This commit is contained in:
parent
aabdb83166
commit
19dedccfc3
4 changed files with 21 additions and 3 deletions
|
@ -1,5 +1,12 @@
|
|||
2015-12-06 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* parser.c (cp_parser_template_argument): Handle references in
|
||||
C++1z mode.
|
||||
* constexpr.c (potential_constant_expression_1): Don't error about
|
||||
TREE_THIS_VOLATILE on declarations.
|
||||
[COMPONENT_REF]: Don't consider the object if we're dealing with
|
||||
an overloaded function.
|
||||
|
||||
* constraint.cc (strictly_subsumes): New.
|
||||
* cp-tree.h: Declare it.
|
||||
* pt.c (process_partial_specialization): Use it instead of
|
||||
|
|
|
@ -4130,7 +4130,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
|
|||
return false;
|
||||
if (t == NULL_TREE)
|
||||
return true;
|
||||
if (TREE_THIS_VOLATILE (t))
|
||||
if (TREE_THIS_VOLATILE (t) && !DECL_P (t))
|
||||
{
|
||||
if (flags & tf_error)
|
||||
error ("expression %qE has side-effects", t);
|
||||
|
@ -4345,6 +4345,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
|
|||
of literal type or of pointer to literal type. */
|
||||
/* This test would be redundant, as it follows from the
|
||||
postfix-expression being a potential constant expression. */
|
||||
if (type_unknown_p (t))
|
||||
return true;
|
||||
return RECUR (TREE_OPERAND (t, 0), want_rval);
|
||||
|
||||
case EXPR_PACK_EXPANSION:
|
||||
|
|
|
@ -15364,7 +15364,16 @@ cp_parser_template_argument (cp_parser* parser)
|
|||
because the argument could really be a type-id. */
|
||||
if (maybe_type_id)
|
||||
cp_parser_parse_tentatively (parser);
|
||||
argument = cp_parser_constant_expression (parser);
|
||||
|
||||
if (cxx_dialect <= cxx14)
|
||||
argument = cp_parser_constant_expression (parser);
|
||||
else
|
||||
{
|
||||
/* With C++17 generalized non-type template arguments we need to handle
|
||||
lvalue constant expressions, too. */
|
||||
argument = cp_parser_assignment_expression (parser);
|
||||
require_potential_constant_expression (argument);
|
||||
}
|
||||
|
||||
if (!maybe_type_id)
|
||||
return argument;
|
||||
|
|
|
@ -8,6 +8,6 @@ struct S { int m; static int s; } s;
|
|||
|
||||
X<&a[2]> x3; // { dg-error "" } address of array element
|
||||
X<&s.m> x4; // { dg-error "" } address of non-static member
|
||||
X<&s.s> x5; // { dg-error "" } &S::s must be used
|
||||
X<&s.s> x5; // { dg-error "" "" { target { ! c++1z } } } &S::s must be used
|
||||
X<&S::s> x6; // OK: address of static member
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue