public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line
@ 2015-06-06  6:19 unmobile at gmail dot com
  2015-06-06  6:30 ` [Bug c++/66439] " unmobile at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: unmobile at gmail dot com @ 2015-06-06  6:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4495 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

            Bug ID: 66439
           Summary: Diagnostic on failed function template lookup is
                    missing a line
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unmobile at gmail dot com
  Target Milestone: ---

Created attachment 35705
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35705&action=edit
Test input

When compiling the attached code, I get a pretty messed-up diagnostic that is
both less than fully informative and suggests there's supposed to be more
output, but doesn't print any:

>    $ g++-5 -c  adltest.cpp 
>    adltest.cpp: In function ‘void g(A::B)’:
>    adltest.cpp:11:12: error: no matching function for call to ‘f(A::B&)’
>       C::f<3>(b); //ill-formed; argument dependent lookup
>                ^
>    adltest.cpp:6:26: note: candidate: template<class T> void C::f(T)
>       template<class T> void f(T t);
>                              ^
>    adltest.cpp:6:26: note:   template argument deduction/substitution failed:

(note the trailing colon ':' on the last line)

This came to light when I tried to compile the code from
http://stackoverflow.com/questions/2953684/why-doesnt-adl-find-function-templates
and saw this trailed-off report. Really, the diagnostic should report more
explicitly what's going on, that C::f isn't a valid binding because the
template parameter '3' doesn't match up with the class parameter C::f expects.
>From gcc-bugs-return-488228-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jun 06 06:26:40 2015
Return-Path: <gcc-bugs-return-488228-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 67340 invoked by alias); 6 Jun 2015 06:26:39 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 66011 invoked by uid 48); 6 Jun 2015 06:26:36 -0000
From: "unmobile at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66440] New: Diagnostic on "'foo' was not declared in this scope" offers an invalid suggestion
Date: Sat, 06 Jun 2015 06:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.1.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: unmobile at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created
Message-ID: <bug-66440-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-06/txt/msg00560.txt.bz2
Content-length: 978

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf440

            Bug ID: 66440
           Summary: Diagnostic on "'foo' was not declared in this scope"
                    offers an invalid suggestion
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: unmobile at gmail dot com
  Target Milestone: ---

Created attachment 35706
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id5706&actioníit
Test input

When I try to compile the attached source with g++ 5.1.1, I get a suggestion to
use C::f. However, an explicit qualified call to C::f with the given template
and function arguments would be invalid, as shown in the later statement.
Perhaps the compiler should evaluate the candidates before enumerating them for
the user, and either drop them or distinguish that they wouldn't actually
match?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/66439] Diagnostic on failed function template lookup is missing a line
  2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
@ 2015-06-06  6:30 ` unmobile at gmail dot com
  2020-05-09 18:18 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: unmobile at gmail dot com @ 2015-06-06  6:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

--- Comment #1 from Phil Miller <unmobile at gmail dot com> ---
Note that clang (from at least 3.5, possibly earlier) gets this right:

> $ clang++-3.5 -c  adltest.cpp 
> adltest.cpp:11:3: error: no matching function for call to 'f'
>   C::f<3>(b); //ill-formed; argument dependent lookup
>   ^~~~~~~
> adltest.cpp:6:26: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'T'
>   template<class T> void f(T t);
>                          ^


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/66439] Diagnostic on failed function template lookup is missing a line
  2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
  2015-06-06  6:30 ` [Bug c++/66439] " unmobile at gmail dot com
@ 2020-05-09 18:18 ` ppalka at gcc dot gnu.org
  2020-05-19  3:52 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-09 18:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/66439] Diagnostic on failed function template lookup is missing a line
  2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
  2015-06-06  6:30 ` [Bug c++/66439] " unmobile at gmail dot com
  2020-05-09 18:18 ` ppalka at gcc dot gnu.org
@ 2020-05-19  3:52 ` cvs-commit at gcc dot gnu.org
  2020-05-19 12:32 ` ppalka at gcc dot gnu.org
  2021-08-09 22:01 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-19  3:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:864fed4a491606a7b17325d847e1d723d2a44104

commit r11-476-g864fed4a491606a7b17325d847e1d723d2a44104
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 18 23:50:14 2020 -0400

    c++: Explain fn template argument type/value mismatches [PR66439]

    In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
    parameter to coerce_template_parms, and this is causing template
    type/value mismatch error messages to get suppressed regardless of the
    value of 'complain'.

    This means that when substitution into a function template fails due to
    a type/value mismatch between a template parameter and the provided
    template argument, we just say "template argument deduction/substitution
    failed:" without a followup explanation of the failure.

    Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

    gcc/cp/ChangeLog:

            PR c++/66439
            * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
            the 'in_decl' parameter to coerce_template_parms.

    gcc/testsuite/ChangeLog:

            PR c++/66439
            * g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
            diagnostic.
            * g++.dg/cpp2a/concepts-ts6.C: Likewise.
            * g++.dg/template/error56.C: Likewise.
            * g++.dg/template/error59.C: New test.

    libstdc++-v3/ChangeLog:

            PR c++/66439
            * testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
            mismatch" messages.
            * testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/66439] Diagnostic on failed function template lookup is missing a line
  2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-19  3:52 ` cvs-commit at gcc dot gnu.org
@ 2020-05-19 12:32 ` ppalka at gcc dot gnu.org
  2021-08-09 22:01 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-19 12:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.0

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/66439] Diagnostic on failed function template lookup is missing a line
  2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-19 12:32 ` ppalka at gcc dot gnu.org
@ 2021-08-09 22:01 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 22:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66439

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu.org

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 60916 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-09 22:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06  6:19 [Bug c++/66439] New: Diagnostic on failed function template lookup is missing a line unmobile at gmail dot com
2015-06-06  6:30 ` [Bug c++/66439] " unmobile at gmail dot com
2020-05-09 18:18 ` ppalka at gcc dot gnu.org
2020-05-19  3:52 ` cvs-commit at gcc dot gnu.org
2020-05-19 12:32 ` ppalka at gcc dot gnu.org
2021-08-09 22:01 ` pinskia 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).