aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2011-11-08 03:20:30 +0000
committerAldy Hernandez <aldyh@redhat.com>2011-11-08 03:20:30 +0000
commit47180e1668b0766d1e473fed8d9385c0e765285d (patch)
tree1eb48ad31d05a9ce117bedc17115de96dffa2f0b /gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
parent80b9b1c40004ddf7dd74248b642d489384f37ace (diff)
parenteb6a1d75b768b663579adeb2a50828cf679b6f12 (diff)
* Merge from mainline rev 181122.transactional-memory
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/transactional-memory@181148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C161
1 files changed, 161 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C b/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
new file mode 100644
index 00000000000..aad273792ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
@@ -0,0 +1,161 @@
+// { dg-options "-std=c++0x -Wzero-as-null-pointer-constant" }
+
+struct A;
+
+typedef int (A::*pointmemfun) (int);
+typedef int (A::*pointdmem);
+typedef int (*pointfun) (int);
+
+pointmemfun pmfs;
+pointdmem pdms;
+pointfun pfs;
+int* ps;
+
+void f()
+{
+ pointmemfun pmf(0); // { dg-warning "zero as null pointer" }
+ pointdmem pdm(0); // { dg-warning "zero as null pointer" }
+ pointfun pf(0); // { dg-warning "zero as null pointer" }
+ int* p(0); // { dg-warning "zero as null pointer" }
+
+ pointmemfun pmfn(nullptr);
+ pointdmem pdmn(nullptr);
+ pointfun pfn(nullptr);
+ int* pn(nullptr);
+
+ pmf = 0; // { dg-warning "zero as null pointer" }
+
+ pdm = 0; // { dg-warning "zero as null pointer" }
+
+ pf = 0; // { dg-warning "zero as null pointer" }
+
+ p = 0; // { dg-warning "zero as null pointer" }
+
+ pmf = nullptr;
+
+ pdm = nullptr;
+
+ pf = nullptr;
+
+ p = nullptr;
+
+ if (pmf)
+ ;
+
+ if (pdm)
+ ;
+
+ if (pf)
+ ;
+
+ if (p)
+ ;
+
+ if (!pmf)
+ ;
+
+ if (!pdm)
+ ;
+
+ if (!pf)
+ ;
+
+ if (!p)
+ ;
+
+ if (pmf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p == 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 == p) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pmf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pdm != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pf != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (p != 0) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pmf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pdm) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != pf) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (0 != p) // { dg-warning "zero as null pointer" }
+ ;
+
+ if (pmf == nullptr)
+ ;
+
+ if (pdm == nullptr)
+ ;
+
+ if (pf == nullptr)
+ ;
+
+ if (p == nullptr)
+ ;
+
+ if (nullptr == pmf)
+ ;
+
+ if (nullptr == pdm)
+ ;
+
+ if (nullptr == pf)
+ ;
+
+ if (nullptr == p)
+ ;
+
+ if (pmf != nullptr)
+ ;
+
+ if (pdm != nullptr)
+ ;
+
+ if (pf != nullptr)
+ ;
+
+ if (p != nullptr)
+ ;
+
+ if (nullptr != pmf)
+ ;
+
+ if (nullptr != pdm)
+ ;
+
+ if (nullptr != pf)
+ ;
+
+ if (nullptr != p)
+ ;
+}