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 8682403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:45:46+00:00 2026-06-12T21:45:46+00:00

Why do I get Error C2597: Illegal reference to non-static member ‘derived<<unnamed-symbol>>::T’ when I

  • 0

Why do I get

Error C2597: Illegal reference to non-static member 'derived<<unnamed-symbol>>::T'

when I try to compile this code in Visual C++ 2010 x64? (It seems fine on x86… which one is correct?)

struct base { typedef int T; };

template<class>
struct derived : base
{
    using base::T;
    derived(T = T()) { }
};

int main()
{
    derived<int>();
    return 0;
}
  • 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-12T21:45:47+00:00Added an answer on June 12, 2026 at 9:45 pm

    As Praetorian’s comment mentions, the problem is with the T() default value. Based on the error details, using base::T apparently confuses the compiler into searching for T() as a call to non-static member function of base rather than the construction of an instance of type T.

    Here’s an interesting fix that works in MSVC 2005 x86 (I haven’t tried any other compiler). Note that T() is preserved. This either disambiguates using base::T or just forces T to reference the inherited type and not the using one (which are apparently not the same thing to the compiler).

    //...
    template<class>
    struct derived : base
    {
        using base::T;
        derived(T = static_cast<T>( T() )) { } //No error
    };
    //...
    

    Edit: Try changing base to this and see what error messages you get:

    struct base { struct T{T(){}}; };
    

    I get the original C2597, but also this:

    error C2440: ‘default argument’ : cannot convert from ” to ‘base::T’
    No constructor could take the source type, or constructor overload resolution was ambiguous

    I don’t know what the compiler means by '' there, but it’s probably a similar problem with the original definition of base. This compiles fine if I remove the using base::T; line.

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

Sidebar

Related Questions

Every time I try to compile my code I get error: cannot convert parameter
When we try to create a view within a funcion we get ERROR: there
Whenever i try using php with lighttpd on my iphone i get error 500
Why do I get Error The type 'string' must be a non-nullable value type
when i compile in VS 2003 ent i get these errors C:\SRC\Program\_Interface\FuncTextCmd.cpp(953): error C2593:
I get this error in my smtdplugin implementation file , when i try to
I get error in 3.2 sdk. imageView.contentScaleFactor = 1.0; error: request for member 'contentScaleFactor'
When i try gg=G or something like that i get error: :.,$!indent shell returned
If I use register names I get: Error: illegal operands `add $t0,$zero,$zero' If I
Because when i compile i get error: I/O Error: Cannot run program jar: CreateProcess

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.