Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358654

Summary: Parser does not like call to variadic template function with no template parameters
Product: [Tools] CDT Reporter: Nathan Ridge <zeratul976>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, da_cra_hunt, yevshif
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: All   
OS: All   
Whiteboard:

Description Nathan Ridge CLA 2011-09-22 15:47:49 EDT
Given a variadic template function:

template <typename...>
void f() {}

Both of the following ways of calling it with no template parameters should be valid:

int main()
{
     f();      // way 1
     f<>();    // way 2
}

For both, CDT gives the error: "Invalid arguments ' Candidates are: void f()'"
Comment 1 David Hunt CLA 2011-10-03 13:41:54 EDT
I believe this is the same issue causing the following behavior with the latest release of libstdc++(gcc 4.6.1) :

[dhunt@dhunt /tmp]$ cat > chk.cpp
#include <string>
#include <tuple>

void f()
{
    std::tuple<std::string, std::string, uint64_t, std::string> tup;

    std::get<0>(tup).c_str();
}

[dhunt@dhunt /tmp]$ g++ -std=c++0x -c chk.cpp
[dhunt@dhunt /tmp]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/dhunt/libexec/gcc/x86_64-unknown-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/home/dhunt/ --enable-languages=c,c++ --with-mpfr=/home/dhunt --with-gmp=/home/dhunt --with-mpc=/home/dhunt
Thread model: posix
gcc version 4.6.1 (GCC) 


The indexer gives a semantic error on the call to "std::get" with "Method c_str() could not be resolved".
Comment 2 Markus Schorn CLA 2011-10-06 04:08:30 EDT
Works with the latest version on the master branch. The problem has the same root cause as bug 355304, the template argument deduction without function parameters did not work.

Added testcase.
Comment 3 CDT Genie CLA 2011-10-06 04:23:01 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 358654: Added testcase.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c88a6117fda52879617c1d7cb5a021bb33346378
Comment 4 CDT Genie CLA 2011-10-06 10:23:05 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 358654: Improve name of testcase.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0975b80370b4cce6cb12f0de3ede06fa6f442cc3