• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bug in g++?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in g++?


  • Subject: Re: Bug in g++?
  • From: Howard Hinnant <email@hidden>
  • Date: Fri, 6 Oct 2006 15:57:15 -0400

On Oct 6, 2006, at 3:06 PM, Steve Checkoway wrote:

Howard Hinnant wrote:
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:

Hi,

What you said makes sense. The only problem is that by making Read () not virtual, the problem goes away. FromStack() is still in the LuaHelpers namespace, from what you said, it should still be looking for it at template definition time.

Ah, the difference there is that if a member function of a template class is virtual, it is allowed to be instantiated (and everyone does). If it isn't virtual, it is required not to be instantiated unless used. So to see the error with read being non-virtual you have to:


int main()
{
    ThemeMetric<GoalType> EDIT_MODE;
    EDIT_MODE.Read();
}

Also, in g++ 4.0 (but not 4.1), this change works

void Read()
{
	using namespace LuaHelpers;
	T x;
	FromStack(x);
}

Surely at least two of the implementations of g++ 3.3, (3.4-4.0), and 4.1 must be wrong.

My best understanding is that 4.0 is in error in accepting this fix. FromStack(x) is bound at instantiation time (also known as phase 2). Ordinary lookup happens in the context of the definition, not the context of the instantiation and finds the first 3 FromStack's. ADL then tries to find some more matches and uses both the definition context and the instantiation context, but only searches the global namespace, and so doesn't find the 4th FromStack.


If that spins your head somewhat, don't feel bad. My head hurts right now too. :-) If you want to explore this in the standard it is 14.6.4.2.

Hope that helps.

-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


  • Follow-Ups:
    • Re: Bug in g++?
      • From: Steve Checkoway <email@hidden>
References: 
 >Bug in g++? (From: Steve Checkoway <email@hidden>)
 >Re: Bug in g++? (From: Howard Hinnant <email@hidden>)
 >Re: Bug in g++? (From: Steve Checkoway <email@hidden>)

  • Prev by Date: OpenGL error
  • Next by Date: Xcode always rebuilds all for project on external volume
  • Previous by thread: Re: Bug in g++?
  • Next by thread: Re: Bug in g++?
  • Index(es):
    • Date
    • Thread