Bug 23965 - [3.4/4.0/4.1 regression] Bogus error message: no matching function for call to 'foo(<type error>)'
Summary: [3.4/4.0/4.1 regression] Bogus error message: no matching function for call t...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P2 minor
Target Milestone: 3.4.5
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: diagnostic, patch
Depends on:
Blocks:
 
Reported: 2005-09-19 14:03 UTC by Volker Reichelt
Modified: 2005-10-06 14:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2005-09-19 14:03:53 UTC
For the testcase

  template<typename T> void foo(T);

  void bar()
  {
    struct A a;
    foo(a);
  }

the we get the following error message since GCC 3.4.0:

  bug.cc: In function 'void bar()':
  bug.cc:5: error: aggregate 'A a' has incomplete type and cannot be defined
  bug.cc:6: error: no matching function for call to 'foo(<type error>)'

Although not completely bogus, the last line is not very helpful here.
Since "a" has error_mark_node as type, overload resolution just won't
work. In fact we shouldn't perform overload analysis here at all IMHO.

Patch under way.
Comment 1 GCC Commits 2005-09-21 15:34:50 UTC
Subject: Bug 23965

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-09-21 15:34:42

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/template: error1.C 

Log message:
	PR c++/23965
	* call.c (resolve_args): Return error_mark_node on arguments
	whose TREE_TYPE is error_mark_node.
	
	* g++.dg/template/error1.C: Reject "no matching function" message.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4898&r2=1.4899
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.552&r2=1.553
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6091&r2=1.6092
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 2 GCC Commits 2005-09-21 15:40:47 UTC
Subject: Bug 23965

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	reichelt@gcc.gnu.org	2005-09-21 15:39:53

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/template: error1.C 

Log message:
	PR c++/23965
	* call.c (resolve_args): Return error_mark_node on arguments
	whose TREE_TYPE is error_mark_node.
	
	* g++.dg/template/error1.C: Reject "no matching function" message.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.243&r2=1.3892.2.244
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.28&r2=1.452.2.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.437&r2=1.3389.2.438
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1&r2=1.1.22.1

Comment 3 Volker Reichelt 2005-09-21 15:41:55 UTC
Fixed on mainline and the 3.4 branch.
Waiting for 4.0 branch to unfreeze.
Comment 4 GCC Commits 2005-10-05 16:00:16 UTC
Subject: Bug 23965

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	reichelt@gcc.gnu.org	2005-10-05 16:00:11

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/template: error1.C 

Log message:
	PR c++/23965
	* call.c (resolve_args): Return error_mark_node on arguments
	whose TREE_TYPE is error_mark_node.
	
	* g++.dg/template/error1.C: Reject "no matching function" message.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.117&r2=1.4648.2.118
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.531.2.8&r2=1.531.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.431&r2=1.5084.2.432
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.82.1

Comment 5 Volker Reichelt 2005-10-05 16:06:18 UTC
This is now fixed on the 4.0 branch, too.

Unfortunately I committed a suboptimal version to the 3.4 branch and mainline:
Misreading Mark's comments on the original patch I used
  if (arg == error_mark_node || error_operand_p (arg))
instead of
  if (error_operand_p (arg))
Since arg == error_mark_node is already checked in error_operand_p,
the first test is superfluous.
I'll keep the PR open until this is fixed.
Comment 6 Volker Reichelt 2005-10-06 14:11:31 UTC
The redundant check is now also fixed:
http://gcc.gnu.org/ml/gcc-cvs/2005-10/msg00190.html
http://gcc.gnu.org/ml/gcc-cvs/2005-10/msg00191.html