This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc and using declarations


"Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de> writes:

> It seems that you still misunderstand it. That is not legal C++.

Well, I omitted some code and forgot public; the compilible equivalent
is

------------------------------------
#include <iostream>

struct A
{
        struct B { int i; };
};
 
int main()
{
	using A::B;
	B b;

	std::cout << b.i << std::endl;

	return 0;
};
----------------------------------

IMHO it is also legal C++ ('using' inside function definition).

BTW I used rude workaround with #define changing lines like

using A::B

to

#define B A::B

and corresponding #undef in the end of scope - it worked in my case
(there were no name clashes) although I think there are some
pitfalls.


-- 
 							With regards, Roman.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]