]> granicus.if.org Git - clang/commit
Add extension to always default-initialize nullptr_t.
authorErich Keane <erich.keane@intel.com>
Fri, 14 Dec 2018 22:22:29 +0000 (22:22 +0000)
committerErich Keane <erich.keane@intel.com>
Fri, 14 Dec 2018 22:22:29 +0000 (22:22 +0000)
commit46efdf2ccc2a80aefebf8433dbf9c7c959f6e629
tree63ab727404da1afaca89c6578f37f135a50922e7
parent2a16197a4c0707d5e77c04ea46da663194b47a98
Add extension to always default-initialize nullptr_t.

Core issue 1013 suggests that having an uninitialied std::nullptr_t be
UB is a bit foolish, since there is only a single valid value. This DR
reports that DR616 fixes it, which does so by making lvalue-to-rvalue
conversions from nullptr_t be equal to nullptr.

However, just implementing that results in warnings/etc in many places.
In order to fix all situations where nullptr_t would seem uninitialized,
this patch instead (as an otherwise transparent extension) default
initializes uninitialized VarDecls of nullptr_t.

Differential Revision: https://reviews.llvm.org/D53713

Change-Id: I84d72a9290054fa55341e8cbdac43c8e7f25b885

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349201 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaInit.cpp
test/Analysis/nullptr.cpp
test/SemaCXX/ast-print-crash.cpp
test/SemaCXX/nullptr_t-init.cpp [new file with mode: 0644]