1 // RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
4 // Don't have decltype yet.
5 typedef __typeof__(nullptr) nullptr_t;
11 void o2(char*); // expected-note {{candidate}}
12 void o2(int A::*); // expected-note {{candidate}}
14 nullptr_t f(nullptr_t null)
16 // Implicit conversions.
25 void (*pf)() = nullptr;
27 void (A::*pmf)() = nullptr;
31 // Can't convert nullptr to integral implicitly.
32 uintptr_t i = nullptr; // expected-error {{incompatible type initializing}}
35 (void)(null == nullptr);
36 (void)(null <= nullptr);
37 (void)(null == (void*)0);
38 (void)((void*)0 == nullptr);
39 (void)(null <= (void*)0);
40 (void)((void*)0 <= nullptr);
41 (void)(1 > nullptr); // expected-error {{invalid operands to binary expression}}
42 (void)(1 != nullptr); // expected-error {{invalid operands to binary expression}}
43 (void)(1 + nullptr); // expected-error {{invalid operands to binary expression}}
44 (void)(0 ? nullptr : 0); // expected-error {{incompatible operand types}}
45 (void)(0 ? nullptr : (void*)0);
50 o2(nullptr); // expected-error {{ambiguous}}
52 // nullptr is an rvalue, null is an lvalue
53 (void)&nullptr; // expected-error {{address expression must be an lvalue}}
54 nullptr_t *pn = &null;
56 // You can reinterpret_cast nullptr to an integer.
57 (void)reinterpret_cast<uintptr_t>(nullptr);
59 // You can throw nullptr.
63 // Template arguments can be nullptr.
64 template <int *PI, void (*PF)(), int A::*PM, void (A::*PMF)()>
67 typedef T<nullptr, nullptr, nullptr, nullptr> NT;