diff options
author | Anders Carlsson <andersca@mac.com> | 2010-11-05 00:12:09 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-11-05 00:12:09 +0000 |
commit | 7da7cc568fedd06fc10474251e4918c5e42f8223 (patch) | |
tree | f022ce299a4b536825e485402fc5933510fc3575 /clang/test/SemaCXX/nullptr.cpp | |
parent | f7f4f50113e0452d9c6183366d95cf67a4361d63 (diff) | |
download | bcm5719-llvm-7da7cc568fedd06fc10474251e4918c5e42f8223.tar.gz bcm5719-llvm-7da7cc568fedd06fc10474251e4918c5e42f8223.zip |
Implement [over.ics.rank]p4: A conversion that does not convert an std::nullptr_t to bool is better than one than does.
llvm-svn: 118269
Diffstat (limited to 'clang/test/SemaCXX/nullptr.cpp')
-rw-r--r-- | clang/test/SemaCXX/nullptr.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/nullptr.cpp b/clang/test/SemaCXX/nullptr.cpp index cc75eab30b6..0a0d098e364 100644 --- a/clang/test/SemaCXX/nullptr.cpp +++ b/clang/test/SemaCXX/nullptr.cpp @@ -1,8 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -ffreestanding %s #include <stdint.h> -// Don't have decltype yet. -typedef __typeof__(nullptr) nullptr_t; +typedef decltype(nullptr) nullptr_t; struct A {}; @@ -69,3 +68,19 @@ template <int *PI, void (*PF)(), int A::*PM, void (A::*PMF)()> struct T {}; typedef T<nullptr, nullptr, nullptr, nullptr> NT; + +namespace test1 { +template<typename T, typename U> struct is_same { + static const bool value = false; +}; + +template<typename T> struct is_same<T, T> { + static const bool value = true; +}; + +void *g(void*); +bool g(bool); + +// Test that we prefer g(void*) over g(bool). +static_assert(is_same<decltype(g(nullptr)), void*>::value, ""); +} |