20153 – [3.4 Regression] ICE when C++ template function contains anonymous union
Description Udo Steinberg 2005-02-22 20:17:18 UTC
The following program causes an internal compiler error when compiled with
gcc-3.4.3 or gcc-4.0 (CVS):
template <typename T>
class C
{
public:
void foo();
};
template <typename T>
void
C<T>::foo()
{
union {
struct {
};
};
};
int main()
{
return 0;
}
Comment 1 Andrew Pinski 2005-02-22 20:22:12 UTC
Reduced to:
template <typename T>
void
foo()
{
union { struct { }; };
}
This is invalid code, if we do without template function we get an error:
t.cc: In function ‘void foo()’:
t.cc:8: error: anonymous struct not inside named type
t.cc:8: warning: anonymous union with no members
Comment 2 Andrew Pinski 2005-02-23 00:00:14 UTC
: Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk (#166).
Comment 4 Mark Mitchell 2005-02-23 05:36:05 UTC
Fixed in 4.0.
Comment 5 Volker Reichelt 2005-09-01 09:13:25 UTC
Taking care of the backport to the 3.4 branch.
Comment 7 Volker Reichelt 2005-09-01 11:49:30 UTC
Fixed also on the 3.4 branch.