re PR c++/55879 ([C++11] nested constexpr Initialisation raises internal compiler error)
PR c++/55879 * semantics.c (cxx_bind_parameters_in_call): Undo DECL_BY_REFERENCE. From-SVN: r196024
This commit is contained in:
parent
58b922f813
commit
70fc7c6c3d
@ -1,5 +1,8 @@
|
||||
2013-02-13 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55879
|
||||
* semantics.c (cxx_bind_parameters_in_call): Undo DECL_BY_REFERENCE.
|
||||
|
||||
PR c++/55993
|
||||
* semantics.c (cxx_fold_indirect_ref): Handle empty bases at
|
||||
non-zero offsets, too.
|
||||
|
@ -6520,6 +6520,15 @@ cxx_bind_parameters_in_call (const constexpr_call *old_call, tree t,
|
||||
if (i == 0 && DECL_CONSTRUCTOR_P (fun))
|
||||
goto next;
|
||||
x = get_nth_callarg (t, i);
|
||||
if (parms && DECL_BY_REFERENCE (parms))
|
||||
{
|
||||
/* cp_genericize made this a reference for argument passing, but
|
||||
we don't want to treat it like one for constexpr evaluation. */
|
||||
gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
|
||||
gcc_assert (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE);
|
||||
type = TREE_TYPE (type);
|
||||
x = convert_from_reference (x);
|
||||
}
|
||||
arg = cxx_eval_constant_expression (old_call, x, allow_non_constant,
|
||||
TREE_CODE (type) == REFERENCE_TYPE,
|
||||
non_constant_p, overflow_p);
|
||||
|
36
gcc/testsuite/g++.dg/cpp0x/constexpr-invisiref1.C
Normal file
36
gcc/testsuite/g++.dg/cpp0x/constexpr-invisiref1.C
Normal file
@ -0,0 +1,36 @@
|
||||
// PR c++/55879
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
class CAddress
|
||||
{
|
||||
public:
|
||||
constexpr CAddress(unsigned long begin) : m_Begin(begin) {}
|
||||
constexpr CAddress(const CAddress &other) : m_Begin(other.m_Begin) {}
|
||||
|
||||
private:
|
||||
unsigned long m_Begin;
|
||||
};
|
||||
|
||||
extern "C" char _lnkDDRRAM;
|
||||
/* internal compiler error on gcc 4.6.3 */
|
||||
const CAddress s_Memmap[2]
|
||||
{
|
||||
{(unsigned long)&_lnkDDRRAM}, /* segmentation fault */
|
||||
{0x40000000},
|
||||
};
|
||||
|
||||
class CNested {
|
||||
public:
|
||||
constexpr CNested(const CAddress primary)
|
||||
: m_PrimaryBlock(primary) {}
|
||||
|
||||
private:
|
||||
CAddress m_PrimaryBlock;
|
||||
};
|
||||
|
||||
/* internal compiler error on gcc 4.7.2 */
|
||||
const CNested s_taskDescriptions[2]
|
||||
{
|
||||
{{0x42000000}},
|
||||
{{0x43000000}},
|
||||
};
|
Loading…
Reference in New Issue
Block a user