• 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 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


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

  • Prev by Date: Re: Finding jnilib on Xcode (that's linked to dylib file)
  • Next by Date: Post link build step
  • Previous by thread: Bug in g++?
  • Next by thread: Re: Bug in g++?
  • Index(es):
    • Date
    • Thread