public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12672] New: Evals template defaults args that it should not
@ 2003-10-18  8:24 igodard at pacbell dot net
  2003-10-18  8:26 ` [Bug c++/12672] " igodard at pacbell dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: igodard at pacbell dot net @ 2003-10-18  8:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12672

           Summary: Evals template defaults args that it should not
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org

The compiler tries to evaluate template default arguments on a result type of an overloaded call on a template function for an overload that cannot be the correct candidate. 

The actual call has two args, and the templated overload with two formals is the target of the call. However, there is also a templated overload with only one argument. That one-arg function has a result type which is itself a template with default args. The compiler tries to evaluate the default args for the type of the template and it blows up because it's undefined for that type.

The problem seems to be that the compiler is not first pruning all candidates with the wrong number of formals before doing type matching. These candidates cannot be the matching overload because they have the wrong number of args. So the compiler is trying to do type matching on impossible overloads, and if that matching (correctly) gets in trouble then you get an error, whereas if arg-number pruning were first then you would get a correct match and no error.

The particular error in the test case is that the evaluation of a default template argument of a type used by the function calls for a member type that doesn't exist for the actual type. However, the actual error in the test doesn't matter - anything that would cause an error during type matching on the wrong (impossible) overload would do.


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-12672-6594@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-12672-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-09-13 15:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-18  8:24 [Bug c++/12672] New: Evals template defaults args that it should not igodard at pacbell dot net
2003-10-18  8:26 ` [Bug c++/12672] " igodard at pacbell dot net
2003-10-18 11:28 ` igodard at pacbell dot net
2003-10-18 16:19 ` pinskia at gcc dot gnu dot org
2003-10-18 19:50 ` bangerth at dealii dot org
2003-12-28 22:13 ` pinskia at gcc dot gnu dot org
     [not found] <bug-12672-6594@http.gcc.gnu.org/bugzilla/>
2009-04-16 17:02 ` igodard at pacbell dot net
     [not found] <bug-12672-4@http.gcc.gnu.org/bugzilla/>
2021-08-25 20:49 ` ppalka at gcc dot gnu.org
2021-08-31 17:31 ` cvs-commit at gcc dot gnu.org
2021-09-13 15:09 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).