- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In a generic lambdas same names are not found correctly, if in the surrounding scope names from a different namespace are imported:
namespace ns
{
template <class F>
void bar2(F f) { f(0); }
template <class F>
void bar1(F f)
{
bar2(f); // (1)
}
}
void foo()
{
using namespace ns;
bar1([&](auto i) { // (2)
// using namespace ns; // (3)
bar1([&](auto j) {}); // (4)
});
}
int main()
{
foo();
}
In icc
I get the error message
error: identifier "bar1" is undefined
in line (4). See also https://godbolt.org/g/PYzWtw The situation changes if (1) is removed, or if in (3) the names from namespace ns
are imported again, or if in (2) and (4) auto
is replaced by int
. Then, the code compiles fine. Since, this error does not occur in other compilers (Gcc 6.3, CLang 4.0), I assume that this is a bug in the Intel compiler. I tried the compiler version 18.0.1 with flag "-std=c++14"
Best, Simon Praetorius
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Simon,
Thanks for reporting this issue. I'll keep you posted with any update on the issue.
Regards,
Viet

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