circle
circle copied to clipboard
internal compiler error on lambda expression
the regular C++ code
#include <cstdio>
template < int m >
void foo() {
printf("m: %d\n", m);
}
int main() {
int m = 2;
[&](){ foo<m>(); }();
return 0;
}
should fail to compile, as m
is not a constant expression, but circle
experiences an internal compiler error:
error: example.cpp:10:16
internal compiler error: cannot access data members of closure at compile time
[&](){ foo<m>(); }();
^
Compiler returned: 1
Oddly enough, nvcc
also dies on this code snippet and fails to emit an error message before doing so.
circle
still provides a helpful error message to help diagnose the problem before it hits the ICE-- so better than nvcc
in that respect!