- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code is rejected with the message
test.cpp(19): error: declaration is incompatible with function template "void Foo
Compiled with: icpc -std=c++14 test.cpp
icpc --version
icpc (ICC) 17.0.2 20170213
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.
constexpr int getN(int n) { return n; }; template<int N, typename T> struct Vec{ }; template<int N> struct Foo { template<typename T> void bar(Vec<getN(N), T> x); //// A workaround // static constexpr int n = getN(N); // template<typename T> void bar(Vec<n, T> x); }; template<> template <typename T> void Foo<0>::bar(Vec<0, T> x) {}
Thanks,
Matthias Hochsteger
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One additional note:
It's working with -std=c++11 instead of -std=c++14
Matthias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes this is a bug and is a duplicate of an existing bug in our database (DPD200416934).
The good news is that it's already fix in our development compiler - the bad news is that the change is too risky to go into 17.0.
It will be fixed in the next 18.0 beta update and of course the final 18.0 release.
Thanks for reporting it. I'm glad you were able to come up with a workaround...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page