What does the standard say about this code?

Discussion in 'C++' started by Evan, Jul 12, 2011.

  1. Evan

    Evan Guest

    I have some code that I don't understand the implications of. GCC
    4.6.1 (and the earlier versions I've tried) accept it, but EDG does
    not (specifically, I've tried with Comeau's online front end and Intel
    CC 11.0).

    I'm quite familiar with some of the weird name lookup issues that
    arise when templates and dependent names are involved, but at least I
    would argue that they shouldn't apply in this case. Is it a defect in
    EDG that it rejects it, a defect in GCC that accepts it, or one of
    those places where the code isn't compliant but compliers aren't
    required to issue a diagnostic?

    EDG reports:
    error: declaration is incompatible with
    "ref_ptr<Wrapper<T>::control> Wrapper<T>::control::alpha()" (declared
    at line 9)
    Wrapper<T>::control::alpha()

    in this code:
    template< typename T >
    class ref_ptr {
    };

    template <typename T>
    class Wrapper {
    class control {
    public:
    static ref_ptr<control> alpha();
    };
    typedef ref_ptr<control> controlRefPtr;
    };

    template <typename T>
    typename Wrapper<T>::controlRefPtr
    Wrapper<T>::control::alpha()
    {
    }
    Evan, Jul 12, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Rahardja
    Replies:
    5
    Views:
    1,092
    John Harrison
    Jul 18, 2003
  2. Xenos
    Replies:
    1
    Views:
    312
    Rob Williscroft
    Jul 10, 2004
  3. Tobias Oed
    Replies:
    11
    Views:
    1,135
    Dan Pop
    Jun 30, 2003
  4. Sten Westerback

    Re: What does the standard say?

    Sten Westerback, Apr 2, 2004, in forum: C Programming
    Replies:
    3
    Views:
    409
    Rob Thorpe
    Apr 6, 2004
  5. r martin

    Re: What does the standard say?

    r martin, Apr 3, 2004, in forum: C Programming
    Replies:
    6
    Views:
    339
    Raymond Martin
    Apr 5, 2004
Loading...

Share This Page