Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358654 - Parser does not like call to variadic template function with no template parameters
Summary: Parser does not like call to variadic template function with no template para...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 15:47 EDT by Nathan Ridge CLA
Modified: 2012-02-23 11:33 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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