Commit c8718cb3 by Dodji Seketeli Committed by Dodji Seketeli

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

From-SVN: r167250
parent 9c7d5cae
2010-11-29 Dodji Seketeli <dodji@redhat.com> 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 PR c++/45383
Reverted patch for PR c++/42260 Reverted patch for PR c++/42260
* cp-tree.h (lookup_conversions): Reverted "Add new bool parameter to * cp-tree.h (lookup_conversions): Reverted "Add new bool parameter to
......
...@@ -2022,6 +2022,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code, ...@@ -2022,6 +2022,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
case INDIRECT_REF: case INDIRECT_REF:
if (TREE_CODE (type1) == POINTER_TYPE if (TREE_CODE (type1) == POINTER_TYPE
&& is_complete (TREE_TYPE (type1))
&& (TYPE_PTROB_P (type1) && (TYPE_PTROB_P (type1)
|| TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE)) || TREE_CODE (TREE_TYPE (type1)) == FUNCTION_TYPE))
break; break;
......
2010-11-29 Dodji Seketeli <dodji@redhat.com> 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 PR c++/45383
Reverted patch for PR c++/42260 Reverted patch for PR c++/42260
* conversion/cast2.C: Reverted new test. * conversion/cast2.C: Reverted new test.
......
// Origin: PR c++/42260
// { dg-do compile }
struct A
{
template<typename T> operator T*();
};
int i = *A();// { dg-error "no match" }
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment