Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

[bug report] Bug for template deduction?

Shenxiu_L_
Beginner
571 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
571 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

0 Kudos
2 Replies
Shenghong_G_Intel
572 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

0 Kudos
Shenghong_G_Intel
571 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

0 Kudos
Reply