From: Jason Merrill Date: Tue, 20 Oct 2015 06:49:13 +0000 (-0400) Subject: re PR c++/67064 (Register asm variable broken) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d8ab59ce04e7df40bf505c7e341599b141e98c4;p=gcc.git re PR c++/67064 (Register asm variable broken) PR c++/67064 * semantics.c (force_paren_expr): Don't mess with hard register vars. From-SVN: r229021 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 842426b5f2d..6ffa733c0ac 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2015-10-19 Jason Merrill + 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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8796b176c15..c0a8b322767 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1660,6 +1660,8 @@ force_paren_expr (tree expr) 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); diff --git a/gcc/testsuite/g++.dg/parse/parens3.C b/gcc/testsuite/g++.dg/parse/parens3.C new file mode 100644 index 00000000000..afb392bc5da --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/parens3.C @@ -0,0 +1,18 @@ +// 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; +}