xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/nullptr.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc #include <typeinfo>
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // CHECK: @_ZTIDn = external constant i8*
6*f4a2713aSLionel Sambuc int* a = nullptr;
7*f4a2713aSLionel Sambuc 
f()8*f4a2713aSLionel Sambuc void f() {
9*f4a2713aSLionel Sambuc   int* a = nullptr;
10*f4a2713aSLionel Sambuc }
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc typedef decltype(nullptr) nullptr_t;
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc nullptr_t get_nullptr();
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc struct X { };
g()17*f4a2713aSLionel Sambuc void g() {
18*f4a2713aSLionel Sambuc   // CHECK: call i8* @_Z11get_nullptrv()
19*f4a2713aSLionel Sambuc   int (X::*pmf)(int) = get_nullptr();
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
f2()22*f4a2713aSLionel Sambuc const std::type_info& f2() {
23*f4a2713aSLionel Sambuc   return typeid(nullptr_t);
24*f4a2713aSLionel Sambuc }
25