This was approved in the Prague 2020 WG21 meeting so let's adjust the
comment. Since it's supposed to be a DR I think we should no longer
limit it to C++20.
P1957R2
* typeck2.c (check_narrowing): Consider T* to bool narrowing
in C++11 and up.
* g++.dg/cpp0x/initlist92.C: Don't expect an error in C++20 only.
+2020-05-07 Marek Polacek <polacek@redhat.com>
+
+ P1957R2
+ * typeck2.c (check_narrowing): Consider T* to bool narrowing
+ in C++11 and up.
+
2020-05-07 Marek Polacek <polacek@redhat.com>
* decl.c (grok_op_properties): Fix spelling of non-static.
}
else if (TREE_CODE (type) == BOOLEAN_TYPE
&& (TYPE_PTR_P (ftype) || TYPE_PTRMEM_P (ftype)))
- /* This hasn't actually made it into C++20 yet, but let's add it now to get
- an idea of the impact. */
- ok = (cxx_dialect < cxx2a);
+ /* C++20 P1957R2: converting from a pointer type or a pointer-to-member
+ type to bool should be considered narrowing. This is a DR so is not
+ limited to C++20 only. */
+ ok = false;
bool almost_ok = ok;
if (!ok && !CONSTANT_CLASS_P (init) && (complain & tf_warning_or_error))
+2020-05-07 Marek Polacek <polacek@redhat.com>
+
+ P1957R2
+ * g++.dg/cpp0x/initlist92.C: Don't expect an error in C++20 only.
+
2020-05-07 Manfred Schwarb <manfred99@gmx.ch>
* gcc.dg/20050121-1.c: Fix broken dg directives.
int main ()
{
- ( Test1({"false"}) ); // { dg-error "narrowing" "" { target c++2a } }
+ ( Test1({"false"}) ); // { dg-error "narrowing" }
( Test2({123}) );
( Test3({456}) );
( Test4({"false"}) );