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

  • Home
  • SEARCH
  • 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 9122413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:05:55+00:00 2026-06-17T06:05:55+00:00

g++ says error: too many arguments to function ‘constexpr std::tuple if I leave out

  • 0

g++ says

error: too many arguments to function ‘constexpr std::tuple

if I leave out the static_cast in the std::make_tuple call

#include <tuple>

typedef int (*func_t)();

int number() {
  return 2;
}

double number(bool a) {
  return 1.2;
}

int main() {
  // With a static_cast it compiles without any error
  // std::tuple<func_t> tup = std::make_tuple(static_cast<func_t>(number));                                                               

  std::tuple<func_t> tup = std::make_tuple(number);
  return 0;
}

Here is full error message:

$ g++ -std=c++11 test.cc
test.cc: In function 'int main()':
test.cc:31:54: error: too many arguments to function 'constexpr std::tuple<typename std::__decay_and_strip<_Elements>::__type ...> std::make_tuple(_Elements&& ...) [with _Elements = {}; typename std::__decay_and_strip<_Elements>::__type = <type error>]'
In file included from test.cc:1:0:
/usr/include/c++/4.7/tuple:844:5: note: declared here
test.cc:31:54: error: conversion from 'std::tuple<>' to non-scalar type 'std::tuple<int (*)()>' requested
$ g++ --version
g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If I change the main function to

int main() {
  std::tuple<func_t> tup = std::make_tuple(static_cast<func_t>(number));                                                               
  return 0;
}

the program compiles just fine. Is it possible to leave out the static_cast somehow? It seems unnecessary to provide the type func_t two times.

  • 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-17T06:05:56+00:00Added an answer on June 17, 2026 at 6:05 am

    Don’t use std::make_tuple. Use braced-init-list as:

    std::tuple<func_t> tup { number };
    

    Now the compiler will select the appropriate overload matching func_t.

    See live demo

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

Sidebar

Related Questions

require_once('/recaptcha/recaptchalib.php'); was in the correct place but the error says: Warning: require_once() [function.require-once]: open_basedir
My compiler complains in a following way: Matrix.cpp:58: error: no matching function for call
i got this error says error:request entity too large when uploading a video about
I am getting an error that says: error: looser throw specifier for 'virtual CPLAT::CP_Window::~CP_Window()'
I got this error twice. it says error: redefinition of '-[SampleTableViewController tableView:cellForRowAtIndexPath:]'
I get an error that says Parse error: syntax error, unexpected T_PRIVATE in E:\PortableApps\xampp\htdocs\SN\AC\ACclass.php
I'm getting the NRE error that says: Object reference not set to an instance
I keep getting a Run Time error that says I am having an Exception
I am new to Python. I get an error that says undefined Variable. I
Drupal is giving me an error message which says : An illegal choice has

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.