Re: Bug in g++?
Re: Bug in g++?
- Subject: Re: Bug in g++?
- From: Howard Hinnant <email@hidden>
- Date: Fri, 6 Oct 2006 13:36:42 -0400
On Oct 6, 2006, at 3:27 AM, Steve Checkoway wrote:
The code in question is attached to the bug report <http://
bugs.debian.org/cgi-bin/bugreport.cgi/t.cc?bug=391334;msg=5;att=1>.
Is this actually a bug in the compiler and if so should I file a
radar or just wait for upstream to fix it and for Apple to
synchronize?
Hi Steve,
I don't believe this is actually a bug. In:
void Read()
{
T x;
LuaHelpers::FromStack(x);
}
The LuaHelpers qualification on FromStack causes the lookup to be
done at template definition time as opposed to template instantiation
time. If you need to, you can delay the lookup to instantiation time
by taking advantage of argument dependent lookup (ADL) and the fact
that the call is dependent on the template parameter. Such a lookup
must be unqualified:
void Read()
{
T x;
FromStack(x);
}
Now this change alone doesn't quite do it. Only the global namespace
is searched during ADL as this is the namespace associated with
GoalType. To make it work you either need to put GoalType in
namespace LuaHelpers, or put FromStack( GoalType &o ) in the global
namespace (or whatever namespace GoalType belongs to).
namespace LuaHelpers
{
void FromStack( bool &Object );
void FromStack( float &Object );
void FromStack( int &Object );
}
struct IThemeMetric
{
public:
virtual ~IThemeMetric() { }
virtual void Read() = 0;
};
template <class T>
struct ThemeMetric : public IThemeMetric
{
public:
void Read()
{
T x;
FromStack(x);
}
};
enum GoalType { a, b, c };
void FromStack( GoalType &o );
ThemeMetric<GoalType> EDIT_MODE;
-Howard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Bug in g++? (From: Steve Checkoway <email@hidden>) |