• 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: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?


  • Subject: Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
  • From: Jeff DuMonthier <email@hidden>
  • Date: Mon, 26 Nov 2007 09:47:18 -0500


On Nov 26, 2007, at 9:11 AM, Alastair Houghton wrote:

On 26 Nov 2007, at 13:11, Jeff DuMonthier wrote:

I did a little more experimenting and found that a using clause can allow access to inherited members in a template class without explicit scoping. That will dramatically reduce the amount of editing necessary to fix things if I have to, but I still find it hard to believe this is correct behavior.

It *is* correct behaviour AFAIK. It's all to do with the rules for looking up symbols defined in template base classes. I believe the relevant bit of the standard is 14.6.2 paragraph 3, where it says:


In the definition of a class template or a member of a class template, if a
base class of the class template depends on a template-parameter, the base class
scope is not examined during unqualified name lookup either at the point of
definition of the class template or member or during an instantiation of the class
template or member.


This is one of many areas where the defined behaviour of C++ deviates substantially from programmers' expectations.

That is putting it very charitably, and I used to try to defend C++ from criticisms of it being just too arcane and complicated for anyone's good.


Well, the question then becomes which is the better fix: redeclaring the entire interface and data members of all template base classes (of template classes) with using clauses in the declaration of every class with such a base, or adding explicit scoping to every reference of a data member or member function of a template parent?

While the using clauses may work in the current version of gcc, I'm guessing that might be considered 'too easy' and more likely to break in a future version. Probably the safer bet is to just explicitly scope all references to members of template base classes in template class definitions. That's going to take a while.


_______________________________________________ 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: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
      • From: Alastair Houghton <email@hidden>
References: 
 >XCode 3.0 header/scope/namespace issues? (From: Jeff DuMonthier <email@hidden>)
 >Re: XCode 3.0 header/scope/namespace issues? (From: Jeff DuMonthier <email@hidden>)
 >Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug? (From: Jeff DuMonthier <email@hidden>)
 >Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug? (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Please help me build in debug mode
  • Next by Date: XCode can't find momc
  • Previous by thread: Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
  • Next by thread: Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
  • Index(es):
    • Date
    • Thread