This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCHes to xvalue handling
- From: Sudakshina Das <sudi dot das at arm dot com>
- To: Jason Merrill <jason at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Cc: nd <nd at arm dot com>
- Date: Fri, 25 May 2018 17:40:11 +0100
- Subject: Re: C++ PATCHes to xvalue handling
- Nodisclaimer: True
- References: <CADzB+2kbdcbJ65BZsSKPw1bdmBOVwX--4Vdsznh62jtB+Sspaw@mail.gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 23/05/18 18:21, Jason Merrill wrote:
The first patch implements the adjustments from core issues 616 and
1213 to the value category of subobjects of class prvalues: they were
considered prvalues themselves, but that was kind of nonsensical. Now
they are considered xvalues. Along with this, I've removed the
diagnostic distinction between xvalues and prvalues when trying to use
one or the other as an lvalue; the important thing is that they are
rvalues.
The second patch corrects various issues with casts and xvalues/rvalue
references: we were treating an xvalue operand to dynamic_cast as an
lvalue, and we were objecting to casts from prvalue to rvalue
reference type.
With the second patch:
commit f7d2790049fd1e59af4b69ee12f7c101cfe4cdab
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed May 23 17:21:39 2018 +0000
Fix cast to rvalue reference from prvalue.
* cvt.c (diagnose_ref_binding): Handle rvalue reference.
* rtti.c (build_dynamic_cast_1): Don't try to build a reference to
non-class type. Handle xvalue argument.
* typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
rvalue reference.
* semantics.c (finish_compound_literal): Do direct-initialization,
not cast, to initialize a reference.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260622
138bc75d-0d04-0410-961f-82ee72b054a4
I have observed the following failure in Spec2017 while building
510.parest_r on aarch64-none-linux-gnu
aarch64-none-linux-gnu-g++ -c -o
source/numerics/matrices.all_dimensions.o -DSPEC -DNDEBUG -Iinclude -I.
-DSPEC_AUTO_SUPPRESS_OPENMP -mcpu=cortex-a57+crypto -Ofast
-fomit-frame-pointer -fpermissive -DSPEC_LP64
source/numerics/matrices.all_dimensions.cc
source/numerics/matrices.all_dimensions.cc: In static member function
'static void dealii::MatrixTools::apply_boundary_values(const
std::map<unsigned int, double>&, dealii::BlockSparseMatrix<number>&,
dealii::BlockVector<number>&, dealii::BlockVector<number>&, bool)':
source/numerics/matrices.all_dimensions.cc:469:50: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[row]];
^
source/numerics/matrices.all_dimensions.cc:472:55: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[row]+1],
^
source/numerics/matrices.all_dimensions.cc:474:55: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[row+1]],
^
source/numerics/matrices.all_dimensions.cc:479:49: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[row]],
^
source/numerics/matrices.all_dimensions.cc:481:51: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[row+1]],
^
source/numerics/matrices.all_dimensions.cc:510:50: error: lvalue
required as unary '&' operand
[this_sparsity.get_rowstart_indices()[0]]);
Sudi
Tested x86_64-pc-linux-gnu, applying to trunk.