Commit 50b27938 by Paolo Carlini Committed by Paolo Carlini

re PR c++/81013 (ICE with invalid union in class hierarchy)

/cp
2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/81013
	* decl.c (xref_basetypes): Early return upon error about derived
	union.

/testsuite
2018-01-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/81013
	* g++.dg/inherit/union3.C: New.

From-SVN: r256856
parent 9f7b87ca
2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81013
* decl.c (xref_basetypes): Early return upon error about derived
union.
2018-01-18 Nathan Sidwell <nathan@acm.org> 2018-01-18 Nathan Sidwell <nathan@acm.org>
PR c++/83160 PR c++/83160
......
...@@ -13801,7 +13801,10 @@ xref_basetypes (tree ref, tree base_list) ...@@ -13801,7 +13801,10 @@ xref_basetypes (tree ref, tree base_list)
CLASSTYPE_NON_LAYOUT_POD_P (ref) = true; CLASSTYPE_NON_LAYOUT_POD_P (ref) = true;
if (TREE_CODE (ref) == UNION_TYPE) if (TREE_CODE (ref) == UNION_TYPE)
error ("derived union %qT invalid", ref); {
error ("derived union %qT invalid", ref);
return;
}
} }
if (max_bases > 1) if (max_bases > 1)
......
2018-01-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/81013
* g++.dg/inherit/union3.C: New.
2018-01-18 Christophe Lyon <christophe.lyon@linaro.org> 2018-01-18 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.dg/rtl/arm/stl-cond.c: Enable on arm*. * gcc.dg/rtl/arm/stl-cond.c: Enable on arm*.
......
// PR c++/81013
struct A
{
virtual void foo() const;
};
union B : A // { dg-error "derived union 'B' invalid" }
{
void foo() const;
};
void bar(const B& b)
{
b.foo();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment