summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-29 16:31:40 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-29 16:31:40 +0000
commit8e8ac75a13190747d6c7ce8f0fb4efe5f52cd40e (patch)
tree6e341f54dc5000bed430e6611dada4fd581bcbdb
parent9960d752f0bd2b1e3f0c62d50deae42a1303c8ce (diff)
downloadgcc-8e8ac75a13190747d6c7ce8f0fb4efe5f52cd40e.tar.gz
Fix PR c++/42260 and ensure PR c++/45383 is fixed
gcc/cp/ c++/42260 * call.c (add_builtin_candidate): At this point the resulting type of an indirection operator should be complete. gcc/testsuite/ c++/42260 c++/45383 * g++.dg/conversion/cast2.C: New test. * g++.dg/conversion/cond4/C: Likewise. Ensures we don't regress on PR c++/45383 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167250 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c1
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/conversion/cast2.C9
-rw-r--r--gcc/testsuite/g++.dg/conversion/cond4.C31
5 files changed, 54 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index feb9620bdcd..40dd7e299e9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2010-11-29 Dodji Seketeli <dodji@redhat.com>
+ PR c++/42260
+ * call.c (add_builtin_candidate): At this point the resulting type
+ of an indirection operator should be complete.
+
+2010-11-29 Dodji Seketeli <dodji@redhat.com>
+
PR c++/45383
Reverted patch for PR c++/42260
* cp-tree.h (lookup_conversions): Reverted "Add new bool parameter to
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index d107a71747e..0f016ca324a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2022,6 +2022,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
case INDIRECT_REF:
if (TREE_CODE (type1) == POINTER_TYPE
+ && is_complete (TREE_TYPE (type1))
&& (TYPE_PTROB_P (type1)
|| TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE))
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a1ebffbbaeb..1cfb5b2dfe6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2010-11-29 Dodji Seketeli <dodji@redhat.com>
+ PR c++/42260
+ * g++.dg/conversion/cast2.C: New test.
+ * g++.dg/conversion/cond4/C: Likewise. This ensures we don't regress on
+ PR c++/45383
+
+2010-11-29 Dodji Seketeli <dodji@redhat.com>
+
PR c++/45383
Reverted patch for PR c++/42260
* conversion/cast2.C: Reverted new test.
diff --git a/gcc/testsuite/g++.dg/conversion/cast2.C b/gcc/testsuite/g++.dg/conversion/cast2.C
new file mode 100644
index 00000000000..ac8329730ea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/cast2.C
@@ -0,0 +1,9 @@
+// Origin: PR c++/42260
+// { dg-do compile }
+
+struct A
+{
+ template<typename T> operator T*();
+};
+
+int i = *A();// { dg-error "no match" }
diff --git a/gcc/testsuite/g++.dg/conversion/cond4.C b/gcc/testsuite/g++.dg/conversion/cond4.C
new file mode 100644
index 00000000000..3bd64763a18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/cond4.C
@@ -0,0 +1,31 @@
+// Origin: PR c++/45383
+// { dg-do run }
+
+struct null {
+ null() {}
+ template<class T>
+ operator T*() const {
+ return 0;
+ }
+
+ template<class C, class T>
+ operator T C::*() const {
+ return 0;
+ }
+private:
+ null(const null&);
+ null& operator=(const null&);
+ void operator&() const;
+};
+
+static struct null null;
+
+int
+main()
+{
+ int* ptr = null;
+ if (ptr == null)
+ return 0;
+ if (ptr != null)
+ return 1;
+}