Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8322929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:33:01+00:00 2026-06-08T23:33:01+00:00

Example template <typename T> struct A { typedef A<T> super; }; template <typename T>

  • 0

Example

template <typename T>
struct A
{
    typedef A<T> super;
};

template <typename T>
struct B : A<T>
{
    B() : super() {} // <-- HERE
};

int main()
{
}

With the MSVC compiler, this compiles as-is. However with gcc, I need to change super() to A<T>::super(). I’m assuming gcc is correct here, however could someone help me understand the rule here and which compiler is technically correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T23:33:03+00:00Added an answer on June 8, 2026 at 11:33 pm

    No, since it’s a dependant name, since A is a class template. You need to either fully qualify it, or use a shortcut B::super. The latter will also tell the compiler that it’s a dependant name and is very handy if the derived class also has lots of template parameters, since B will expand to B<T, and, stuff> since it’s the injected class name.

    MSVC is wrong here thanks to its incomplete two-phase lookup. Basically, with MSVC, all the dependency checks and stuff only happen during instantiation of the template, while it should have been checked at declaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code template<typename T, int N> struct A { typedef T value_type;
I came across this example here : #include <vector> #include <cstddef> template<typename Tag> class
A simple example: template<typename _X> // this template parameter should be usable outside! struct
example: template<typename T> struct type_of { typedef boost::mpl::if_<boost::is_pointer<T>, typename boost::remove_pointer<T>::type, T >::type type; };
Consider the following example: struct Scanner { template <typename T> T get(); }; template
The title is pretty self-explanatory, but here's a simplified example: #include <cstdio> template <typename
Consider next example : #include <iostream> #include <typeinfo> template< int N, typename T >
I wish to do something like this: template<typename ...T> struct foo { bar<0 /*to
In the boost::spirit documentation, grammars are defined by using struct. For example, template <typename
Consider the following code: template<size_t head,size_t ... Dims> struct make_vec { typedef typename make_vec<Dims...>::type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.