Commit b9934ad8 by Marek Polacek

c++: Add test for DR 1423, Convertibility of nullptr to bool.

DR 1423, which supersedes DR 654, says that you can't copy-init
a bool from a std::nullptr_t:

  bool b = nullptr;  // error

Conversely, it works with direct-initialization which is more
permissive than copy-initialization.

No code changes necessary since we handle it right.

2020-02-26  Marek Polacek  <polacek@redhat.com>

	DR 1423, Convertibility of nullptr to bool.
	* g++.dg/DRs/dr1423.C: New test.
parent d6ff2207
2020-02-26 Marek Polacek <polacek@redhat.com> 2020-02-26 Marek Polacek <polacek@redhat.com>
DR 1423, Convertibility of nullptr to bool.
* g++.dg/DRs/dr1423.C: New test.
2020-02-26 Marek Polacek <polacek@redhat.com>
PR c++/93803 - ICE with constexpr init and [[no_unique_address]]. PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
* g++.dg/cpp2a/constexpr-init16.C: New test. * g++.dg/cpp2a/constexpr-init16.C: New test.
* g++.dg/cpp2a/constexpr-init17.C: New test. * g++.dg/cpp2a/constexpr-init17.C: New test.
......
// DR 1423 - Convertibility of nullptr to bool.
// { dg-do compile { target c++11 } }
bool b = nullptr; // { dg-error "converting to .bool. from .std::nullptr_t. requires direct-initialization" }
bool b2(nullptr);
bool b3{nullptr};
bool b4 = { nullptr }; // { dg-error "converting to .bool. from .std::nullptr_t. requires direct-initialization" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment