[Bug c++/81270] [concepts] ill-formed code with a constrained variable declaration with multiple declarators with different deduced types not rejected
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 15 09:38:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81270
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-10-15
Ever confirmed|0 |1
Known to fail| |10.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Still accepted by current trunk.
Also accepted when modernised to C++2a syntax:
template<typename> concept C = true;
C auto v1 = 1, v2 = nullptr; // Ill-formed.
// Following code to demonstrate that the types of v1 and v2 are deduced
// to different types.
template<typename, typename> struct is_same {
static constexpr bool value = false;
};
template<typename T> struct is_same<T,T> {
static constexpr bool value = true;
};
static_assert(is_same<decltype(v1),int>::value);
static_assert(is_same<decltype(v2),decltype(nullptr)>::value);
More information about the Gcc-bugs
mailing list