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
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);
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:
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;
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