[gnu.g++.bug] second level unnamed union members not accessible

ken@CS.ROCHESTER.EDU (Ken Yap) (10/07/88)

Problem:

Cannot refer to member of an unnamed union within another unnamed union.

Session log:

[elm 26] g++ -v -g bug2.cc
g++ version 1.25.1
 /u/cs454/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix bug2.cc /tmp/cca13389.cpp
GNU CPP version 1.25.1
 /u/cs454/lib/gcc-c++ /tmp/cca13389.cpp -quiet -dumpbase bug2.cc -noreg -version-G -o /tmp/cca13389.s
GNU C++ version 1.25.1 (68k, MIT syntax) compiled by GNU C version 1.25.
In function int main ():
bug2.cc:20: structure has no member named `j'

Program:

struct foo
{
	union
	{
		int		i;
		union
		{
			int		j;
			float		f;
		};
	};
};

main()
{
	foo		bar;
	int		n = 42;

	bar.i = n;
	bar.j = n;
}

Version and environment:

g++ version 1.25.1

tm.h = tm-sun3.h
md = m68k.md
aux-output.c = output-m68k.c

sun 3-50, Sun Unix 3.4