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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:52:57+00:00 2026-06-15T12:52:57+00:00

I am scratching my head with a strange problem highlighted by the following minimal

  • 0

I am scratching my head with a strange problem highlighted by the following minimal code:

struct A {
    template <typename ...X, typename ...Y>
    void f(X... a, Y...b) {
    }

    template <typename ...X>
    void g(X...c) {
       f<X...> (c...);
    }
};

template <typename T>
struct B {
    template <typename ...X, typename ...Y>
    void f(X... a, Y...b) {
    }

    template <typename ...X>
    void g(X...c) {
       f<X...> (c...);
    }
};



int main() {
    A a;
    a.g(); // Compiles without problem

    B<int> b;
    b.g(); // Compiler complains saying g() calls f<>() with 0 arguments while 1 is expected
}

Both g++ and clang++ give the same basic error messages for the second case.
They basically say that the call to f() within the templated class needs one argument.

Is this a bug in both compilers, or am I missing something in the C++ standard?

  • 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-15T12:52:57+00:00Added an answer on June 15, 2026 at 12:52 pm

    The method taking two parameter packs is illegal according to 14.1 [temp.param] paragraph 11:

    … A template parameter pack of a function template shall not be followed by another template parameter unless that template parameter can be deduced from the parameter-type-list
    of the function template or has a default argument (14.8.2). [ Example:

    template<class T1 = int, class T2> class B; // error
    // U cannot be neither deduced from the parameter-type-list nor specified
    template<class... T, class... U> void f() { } // error
    template<class... T, class U> void g() { } // error
    

    —end example ]

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

Sidebar

Related Questions

Really scratching my head now. what is wrong with the following backbone.js code? It
I am scratching my head on what is going in the following code. class
got a strange problem that has so far left me scratching my head. I
i've been scratching my head these last few days on that problem so i
I am scratching my head to figure out a solution to the following question:
I've been scratching my head for several hours for this... problem: Binary Tree (0)
Scratching my head about this. In the rendered HTML for the code below, the
I am scratching my head over this, but have no idea what the problem
I have been scratching my head over an encoding problem with a Tomcat web
I'm scratching my head over trying to implement some code to share textures between

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.