Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

[bug report] Bug for template deduction?

Shenxiu_L_
Beginner
185 Views

I am using Intel C++ compiler 15.0 for Windows and there's a simple case that cannot compile.

#include 

class Foo {
public:
    Foo() {}
    ~Foo() {}
    void test() const { std::cout << "Hello world!" << std::endl; }
};

template<typename T> void test(const T& t) { t.test(); }

template<typename T, void F(const T&)=test<T> >
void bar(const T& t) {
    F(t);
}

int main() {
    Foo foo;
    bar<Foo>(foo);
    return 0;
}

It can successfully compile on other compilers including msvc, g++(both linux and windows), clang++(both linux and windows) and intel compiler on linux (with std=c++11 option). However on Windows, intel compiler (again with c++11 support) complains "error : no instance of function template "bar" matches the argument list", which does not make sense at all. Anyone could confirm this bug? Thanks in advance!

0 Kudos
1 Solution
Shenghong_G_Intel
185 Views

Hi Shenxiu,

I can reproduce the issue with 15.0 and also 16.0 beta and will submit it to developer to fix. It seems like a bug. I'll keep you updated.

Thanks,

Shenghong

View solution in original post

2 Replies
Shenghong_G_Intel
186 Views

Hi Shenxiu,

I can reproduce the issue with 15.0 and also 16.0 beta and will submit it to developer to fix. It seems like a bug. I'll keep you updated.

Thanks,

Shenghong

View solution in original post

Shenghong_G_Intel
185 Views

Hi Shenxiu,

This issue is fixed in v16.0 initial release, I've verified it. Please upgrade to v16.0. Let me know in case you still have issues with this test case.

Thanks,

Shenghong

Reply