PR c++/67064
* semantics.c (force_paren_expr): Don't mess with hard register vars.
From-SVN: r229021
2015-10-19 Jason Merrill <jason@redhat.com>
+ PR c++/67064
+ * semantics.c (force_paren_expr): Don't mess with hard register vars.
+
Implement N4268, Do constant evaluation of all non-type template args.
* parser.c (cp_parser_template_argument): For C++1z just parse a
constant-expression.
REF_PARENTHESIZED_P (expr) = true;
else if (type_dependent_expression_p (expr))
expr = build1 (PAREN_EXPR, TREE_TYPE (expr), expr);
+ else if (VAR_P (expr) && DECL_HARD_REGISTER (expr))
+ /* We can't bind a hard register variable to a reference. */;
else
{
cp_lvalue_kind kind = lvalue_kind (expr);
--- /dev/null
+// PR c++/67064
+// { dg-options "-w" }
+
+struct s {
+ int i;
+};
+
+register struct s *reg __asm__( "1" );
+
+int f(void)
+{
+ int i;
+
+ i = reg->i;
+ i = (reg)->i;
+
+ return i;
+}