[Bug c++/63192] non-mutable lambda capture by value on reference does not apply const
ville.voutilainen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Dec 13 23:40:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63192
--- Comment #2 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Reduced:
template <class, class> struct same {static constexpr bool value = false;};
template <class T> struct same<T, T> {static constexpr bool value = true;};
int main() {
float x, &r = x;
[=] { // x and r are not captured (appearance in a decltype operand is not
an odr-use)
static_assert(same<decltype(x), float>::value, "");
static_assert(same<decltype((x)), float const&>::value, "");
static_assert(same<decltype(r), float&>::value, "");
static_assert(same<decltype((r)), float const&>::value, "");
}();
}
More information about the Gcc-bugs
mailing list