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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:08:11+00:00 2026-05-26T10:08:11+00:00

I wonder if I’m doing something wrong or if this is a compiler bug.

  • 0

I wonder if I’m doing something wrong or if this is a compiler bug. I’m using Intel C++ Composer XE 2011 for Windows with SP1 (or update 6, which is currently the latest). See the commented lines in the code.

#include <tchar.h>
#include <iostream>
#include <conio.h>

template <typename ...T>
struct first_va_arg {};

template <typename T0, typename ...T_>
struct first_va_arg<T0, T_...> {
    typedef T0    type;
};

template <typename ...T>
inline first_va_arg<T...>::type getFirstArgTypeDefaultValue( const T& ...values )
{
//Next line causes error: nontype "first_va_arg<T...>::type [with T=<T...>]" is not a type name
    typedef first_va_arg<T...>::type    FirstArgT;
    return FirstArgT();
//It works correctly if you comment out the above two lines and uncomment the single line below
    //return first_va_arg<T...>::type();
}


int _tmain(int argc, _TCHAR* argv[])
{
    std::cout << getFirstArgTypeDefaultValue(5.67, 32) << std::endl;
    _getch();
    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-05-26T10:08:11+00:00Added an answer on May 26, 2026 at 10:08 am

    Since you have dependent name, you need to say typename:

    template <typename ...T> inline typename first_va_arg<T...>::type getFirstArgTypeDefaultValue( const T& ...values )
    //                              ^^^^^^^^
    {
      typedef typename first_va_arg<T...>::type FirstArgT;
      //..
    }
    

    Note that you are missing the base case for no parameters. I would probably do away with the partial specialization and just declare the primary template as:

    template <typename T, typename...> struct first_va_arg  { typedef T type; };
    

    Then, when you say first_va_arg<>::type, you don’t get a “non-existing name” error, but a potentially more meaningful “template parameter mismatch”. Up to you. Alternatively you could only declare the primary template but leave it undefined.

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

Sidebar

Related Questions

wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td>
I wonder if someone knows if there is a pre-made solution for this: I
I wonder whether someone may be able to help me please. Using some excellent
I wonder what's the best approach for using third party js libraries on a
I wonder what I should be carefull of updating PHP on Windows(with Apache). My
I wonder if any other users of PhpMyAdmin for Mysql have come across this
I wonder if this would be doable ? To insert an array into one
Wonder if this possible. Saw many posts on adding watermark after the pdf is
wonder if I could get some advice on the best way to solve this
Wonder if anyone can help me with this problem. I have created a Window

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.