https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85118
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |6.4.0, 7.3.0, 8.0.1 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- GCC 5, Clang and EDG all compile it. GCC 6 onwards fail with: 85118.C: In instantiation of 'main()::<lambda(auto:1&& ...)> [with auto:1 = {volatile char}]': 85118.C:114:51: required by substitution of 'template<class ... auto:1> main()::<lambda(auto:1&& ...)>::operator decltype (((const main()::<lambda(auto:1&& ...)>*)((const main()::<lambda(auto:1&& ...)>* const)0u))->operator()(static_cast<auto:1&>(main::__lambda0::_FUN::<unnamed>) ...)) (*)(auto:1&& ...)() const [with auto:1 = {volatile char}]' 85118.C:79:56: required by substitution of 'template<class _Args, class _Result> _Result std::_Bind<_Functor, _Bound_args>::operator()(_Args&&) volatile [with _Args = char; _Result = <missing>]' 85118.C:121:12: required from here 85118.C:116:23: error: no matching function for call to 'isOneOf(volatile char)' return isOneOf(std::forward<decltype(params)>(params)...); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 85118.C:101:6: note: candidate: bool isOneOf(const T&) [with T = volatile char] <near match> bool isOneOf(const T& ) ^~~~~~~ 85118.C:101:6: note: conversion of argument 1 would be ill-formed: 85118.C:116:23: error: invalid initialization of non-const reference of type 'const volatile char&' from an rvalue of type 'volatile char' return isOneOf(std::forward<decltype(params)>(params)...); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 85118.C:107:6: note: candidate: template<class T, class FirstType, class ... Tail> bool isOneOf(const T&, const FirstType&, const Tail& ...) bool isOneOf(const T& t, const FirstType& firstValue, const Tail&... tail) ^~~~~~~ 85118.C:107:6: note: template argument deduction/substitution failed: 85118.C:116:23: note: candidate expects at least 2 arguments, 1 provided return isOneOf(std::forward<decltype(params)>(params)...); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 85118.C:76:10: warning: '_Result std::_Bind<_Functor, _Bound_args>::operator()(_Args&&) [with _Args = char; _Result = bool; _Functor = const main()::<lambda(auto:1&& ...)>; _Bound_args = char]' used but never defined operator()(_Args&& __args); ^~~~~~~~ The error says "invalid initialization of non-const reference of type 'const volatile char&' from an rvalue of type 'volatile char'" which is bogus, because const volatile char& is not a non-const reference.