This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70106] [4.9/5 Regression][C++11 or above] adding parenthesis [cerr << (var)] cause error: invalid static_cast from type 'const size_t {aka const long unsigned int}' to type 'size_t& {aka long unsigned int&}'
- From: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 26 May 2016 18:18:16 +0000
- Subject: [Bug c++/70106] [4.9/5 Regression][C++11 or above] adding parenthesis [cerr << (var)] cause error: invalid static_cast from type 'const size_t {aka const long unsigned int}' to type 'size_t& {aka long unsigned int&}'
- Auto-submitted: auto-generated
- References: <bug-70106-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70106
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Author: ppalka
Date: Thu May 26 18:17:43 2016
New Revision: 236792
URL: https://gcc.gnu.org/viewcvs?rev=236792&root=gcc&view=rev
Log:
Fix PR c++/70822 (bogus error with parenthesized SCOPE_REF)
gcc/cp/ChangeLog:
PR c++/70822
PR c++/70106
* cp-tree.h (REF_PARENTHESIZED_P): Make this flag apply to
SCOPE_REFs too.
* pt.c (tsubst_qualified_id): If REF_PARENTHESIZED_P is set
on the qualified_id then propagate it to the resulting
expression.
(do_auto_deduction): Check REF_PARENTHESIZED_P on SCOPE_REFs
too.
* semantics.c (force_paren_expr): If given a SCOPE_REF, just set
its REF_PARENTHESIZED_P flag.
gcc/testsuite/ChangeLog:
PR c++/70822
PR c++/70106
* g++.dg/cpp1y/auto-fn32.C: New test.
* g++.dg/cpp1y/paren4.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/cpp1y/auto-fn32.C
trunk/gcc/testsuite/g++.dg/cpp1y/paren4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog