in Education by
All compilers I could get my hands on agree that this is fine: template auto foo(Check, T...) -> void; template auto foo(int, T...) -> void; int main() { foo(7, ""); } However, the following code (with a leading template parameter that cannot be deduced from the function parameters) is ambiguous according to gcc: template auto bar(Check, T...) -> void; template auto bar(int, T...) -> void; int main() { bar(7, ""); // ambiguous according to gcc bar(7); // just fine } On the other hand, clang, msvc and icc are quite happy with this. Which compiler is right? References to the respective sections of the standard preferred. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
This is core issue 200. The description of how the partial ordering of template functions is determined in 14.5.6.2 [temp.func.order] paragraphs 3-5 does not make any provision for nondeduced template parameters. For example, the function call in the following code is ambiguous, even though one template is "obviously" more specialized than the other: template T f(int); template T f(U); void g() { f(1); } The reason is that neither function parameter list allows template parameter T to be deduced; both deductions fail, so neither template is considered more specialized than the other and the function call is ambiguous. The resolution of core issue 214, which this one was reduced to, introduced [temp.deduct.partial]/11: In most cases, all template parameters must have values in order for deduction to succeed, but for partial ordering purposes a template parameter may remain without a value provided it is not used in the types being used for partial ordering. Apparently GCC's implementation of this wording is buggy once packs come into play.

Related questions

0 votes
    Is there a way to utilise the GCC compiler whilst still being able to develop via the Visual Studio IDE ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    Is there a way to utilise the GCC compiler whilst still being able to develop via the Visual Studio IDE ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    Is there a way to utilise the GCC compiler whilst still being able to develop via the Visual Studio IDE ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    _______ allows you to modify the error behavior so that you can browse the function call stack (a) debug() ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    The recover() function will first print out the function call stack when an _______ occurs. (a) Error (b ... Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    __________ prints out the function call stack after an error occurs. (a) trace() (b) traceback() (c) ... Debugging of R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I have an embedded IoT project that I like to first develop in part by using PC tools such as ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    I work on graphics applications and have been using shared & unique pointers essentially because it handles memory ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    I am trying to understand the usage of private const in the class. My understanding is that private const is used to make ... (void) { int const MyExample::x = 3; std::cout...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I had a program working good (without prompting errors) using references, but I decided to use a pointer-to-pointer array ... that it is there because I have put two flags (cout...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    I am working on a collection of classes used for video playback and recording. I have one main class ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    I want to improve the next code, calculating the mean: void calculateMeanStDev8x8Aux(cv::Mat* patch, int sx, int sy, int& ... the next loop with NEON intrinsics: for (int i=0; i...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    If two vectors with different lengths perform some operation, the elements of the shorter vector will be used ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    ________ function generates n normal random numbers based on the mean and standard deviation arguments passed to ... R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    _________ is an indication that a fatal problem has occurred and execution of the function stops. (a) message (b ... of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
...