- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there. The following C++11 code fails to compile correctly:
#include <utility> template <class F> struct foo { template <class... Args> auto operator()(Args &&... args) -> decltype(std::declval<F>()(std::forward<Args>(args)...)); }; template <class F> template <class... Args> auto foo<F>::operator()(Args &&... args) -> decltype(std::declval<F>()(std::forward<Args>(args)...)) { return F()(std::forward<Args>(args)...); } struct fun { int operator()(int) { return 0; } }; int main() { return foo<fun>()(1); }
I get no compilation error with clang++ or g++...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Just FYI, This issue has been addressed in the 17.0 beta compiler which is available in the below link.
https://software.intel.com/en-us/articles/intel-parallel-studio-xe-2017-beta
Thanks,
Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Reddy, yes this is fixed in the beta compiler.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately, I managed to trigger a similar bug with the beta version. I'm still struggling to build a minimal working example.
It's part of a bigger goal: trying to use icpc as a backend compiler for the pythran project (http://pythonhosted.org/pythran). Pythran runtime headers compile fine with g++ and clang++, but icpc chokes on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @sguelton,
I cannot reproduce with test samples on my end including the one you indicated in this thread. Appreciate if you can create a test reproducer. Can you compile with -P option to generate a preprocessed file and attach the generated .I file so I can reproduce the issue? Thanks for your help.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the test case. I was able to reduce it to the following which does get a spurious error using our latest compiler:
Spurious errors:
sptxl15-489> icpc -std=c++11 -c bug.cpp
bug.cpp(33): error: declaration is incompatible with "auto C<Arg>::foo(int)->Arg" (declared at line 28)
auto C<Arg>::foo(int i) -> decltype(this->fast(i))
^
bug.cpp(33): error: "this" may only be used inside a nonstatic member function
auto C<Arg>::foo(int i) -> decltype(this->fast(i))
^
compilation aborted for bug.cpp (code 2)
sptxl15-490>
// bug.cpp
template <class Arg>
struct C {
Arg fast(int i);
auto foo(int i) -> decltype(this->fast(i));
template <class E> C<C> fast(E const &expr) const; // somehow this overload causes problem
};
template <class Arg>
auto C<Arg>::foo(int i) -> decltype(this->fast(i))
{
return true;
}
I have submitted a bug report in our internal bugs database under the number DPD200409734.
Again, thanks for letting us know...
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great, thanks Judy I'll monitor this issue and let @sguelton, know as soon as the release with the fix is out.
Hi @sguelton - thanks for the reproducer and I'll keep you updated on the progress of this issue.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot Kittur and Judith! Let me know when I can download a new icc (preview version) and run it on the whole pythran database. That's a very good test case for icc :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure, will do. Again, thanks for your patience through this towards resolution.
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for letting us know. I'll look into reproducing the issue on your new attached .I file and will pass on the info to the team - appreciate much.
Regards,
Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there - topic revival.
I've checked the latest release, and the problem is still there... any status on this?

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