23965 – [3.4/4.0/4.1 regression] Bogus error message: no matching function for call to 'foo()' (original) (raw)

Description Volker Reichelt 2005-09-19 14:03:53 UTC

For the testcase

template 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()'

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 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 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.