This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 37554
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 27 Jan 2009 19:30:24 +0100
- Subject: [C++ Patch] PR 37554
Hi,
this patchlet solves an ice-on-invalid, 4.4 (and 4.3) regression: I
changed the function to just return back error_mark_node
unconditionally. As regards crash9.C, I don't think we are regressing
with the error message. We get:
crash9.C: In function âvoid g(const C&)â:
crash9.C:10: error: invalid use of incomplete type âstruct Câ
crash9.C:6: error: forward declaration of âstruct Câ
crash9.C:10: error: initializing argument 1 of âvoid f(T) [with T = C]â
compared to the current:
crash9.C: In function âvoid g(const C&)â:
crash9.C:10: error: invalid use of incomplete type âstruct Câ
crash9.C:6: error: forward declaration of âstruct Câ
crash9.C:10: error: initializing argument 1 of âvoid f(T) [with T = C]â
crash9.C: In function âvoid f(T) [with T = C]â:
crash9.C:10: instantiated from here
crash9.C:4: error: â<anonymous>â has incomplete type
crash9.C:6: error: forward declaration of âstruct Câ
and to the old (e.g., in 4_2-branch):
crash9.C: In function âvoid f(T) [with T = C]â:
crash9.C:10: instantiated from here
crash9.C:4: error: â<anonymous>â has incomplete type
crash9.C:6: error: forward declaration of âstruct Câ
For comparison, ICC issues:
crash9.C(10): error: no instance of function template "f" matches the
argument list
argument types are: (const C)
f(c); // { dg-error "" } invalid use of undefined type
Tested x86_64-linux. Ok for mainline?
Paolo.
//////////////////////
/cp
2009-01-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37554
* call.c (build_over_call): If convert_for_arg_passing returns
error_mark_node unconditionally return it.
/testsuite
2009-01-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37554
* g++.dg/parse/crash51.C: New.
* g++.old-deja/g++.pt/crash9.C: Adjust.
Index: testsuite/g++.old-deja/g++.pt/crash9.C
===================================================================
*** testsuite/g++.old-deja/g++.pt/crash9.C (revision 143706)
--- testsuite/g++.old-deja/g++.pt/crash9.C (working copy)
***************
*** 1,11 ****
// { dg-do assemble }
template <class T>
! void f(T) {} // { dg-error "" } parameter has incomplete type
! class C; // { dg-error "" } forward declaration
void g(const C& c)
{
! f(c); // { dg-error "" } invalid use of undefined type
}
--- 1,11 ----
// { dg-do assemble }
template <class T>
! void f(T) {}
! class C; // { dg-error "forward declaration" }
void g(const C& c)
{
! f(c); // { dg-error "invalid use of incomplete type|initializing argument" }
}
Index: testsuite/g++.dg/parse/crash51.C
===================================================================
*** testsuite/g++.dg/parse/crash51.C (revision 0)
--- testsuite/g++.dg/parse/crash51.C (revision 0)
***************
*** 0 ****
--- 1,9 ----
+ // PR c++/37554
+
+ struct A {};
+ class B : A {};
+
+ void foo(B b)
+ {
+ (A)b; // { dg-error "inaccessible base" }
+ }
Index: cp/call.c
===================================================================
*** cp/call.c (revision 143706)
--- cp/call.c (working copy)
*************** build_over_call (struct z_candidate *can
*** 5276,5282 ****
(conv, TREE_VALUE (arg), fn, i - is_method, complain);
val = convert_for_arg_passing (type, val);
! if ((complain == tf_none) && val == error_mark_node)
return error_mark_node;
else
argarray[j++] = val;
--- 5276,5282 ----
(conv, TREE_VALUE (arg), fn, i - is_method, complain);
val = convert_for_arg_passing (type, val);
! if (val == error_mark_node)
return error_mark_node;
else
argarray[j++] = val;