public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments
@ 2013-05-24 12:27 redi at gcc dot gnu.org
  2013-05-24 12:34 ` [Bug c++/57397] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-24 12:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57397
           Summary: Off-by-one error in diagnostic when calling variadic
                    function template with too few arguments
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

template<class T1, class T2, class... Tn>
void foo(T1, Tn...)
{ }

int main()
{
    foo();
}

t.cc: In function 'int main()':
t.cc:7:9: error: no matching function for call to 'foo()'
     foo();
         ^
t.cc:7:9: note: candidate is:
t.cc:2:6: note: template<class T1, class T2, class ... Tn> void foo(T1, Tn ...)
 void foo(T1, Tn...)
      ^
t.cc:2:6: note:   template argument deduction/substitution failed:
t.cc:7:9: note:   candidate expects 2 arguments, 0 provided
     foo();
         ^


The function expects 1 or more arguments, saying 2 is entirely bogus.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
@ 2013-05-24 12:34 ` paolo.carlini at oracle dot com
  2013-05-24 12:43 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-24 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-24
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Gosh, we must fix this.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
  2013-05-24 12:34 ` [Bug c++/57397] " paolo.carlini at oracle dot com
@ 2013-05-24 12:43 ` redi at gcc dot gnu.org
  2013-05-24 13:19 ` daniel.kruegler at googlemail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-24 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.7.3, 4.8.1, 4.9.0

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm amazed I've never noticed it before, but it's present on all active
branches.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
  2013-05-24 12:34 ` [Bug c++/57397] " paolo.carlini at oracle dot com
  2013-05-24 12:43 ` redi at gcc dot gnu.org
@ 2013-05-24 13:19 ` daniel.kruegler at googlemail dot com
  2013-05-24 17:20 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-05-24 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
I simply guess that it had been noticed but no-one cared enough to file a
bugzilla entry for it.
>From gcc-bugs-return-423061-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 24 13:21:33 2013
Return-Path: <gcc-bugs-return-423061-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31318 invoked by alias); 24 May 2013 13:21:32 -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 30933 invoked by uid 48); 24 May 2013 13:21:29 -0000
From: "ramana at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/55701] Inline some instances of memset for ARM
Date: Fri, 24 May 2013 13:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: ramana at gcc dot gnu.org
X-Bugzilla-Status: NEW
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_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-55701-4-mr9ZHm8aWp@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55701-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55701-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: 2013-05/txt/msg01734.txt.bz2
Content-length: 567

http://gcc.gnu.org/bugzilla/show_bug.cgi?idU701

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-24
                 CC|                            |ramana at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-05-24 13:19 ` daniel.kruegler at googlemail dot com
@ 2013-05-24 17:20 ` paolo.carlini at oracle dot com
  2013-05-24 17:22 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-24 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
The core issue is very simple. Funny however the error messages you can get for
some other invalid cases, like I tried:

template<class T1, class... T2, class... Tn>
void boo(T1, T2..., Tn...)
{ }

int main()
{
  boo(1);
}

then my clang++ (not very up to date) says at least 2 arguments are needed. For
fun you give 2 and it says that 1 is required ;) ICC doesn't even try
suggesting the right number ;) I guess that while we are at it we want to say
"at least 2" for the original testcase filed by Jon (thus we can't just call
unify_arity with the right arguments) and then better handle in the diagnostic
parameters which can't be deduced anyway.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-05-24 17:20 ` paolo.carlini at oracle dot com
@ 2013-05-24 17:22 ` paolo.carlini at oracle dot com
  2014-07-30 20:07 ` paolo at gcc dot gnu.org
  2014-07-30 20:08 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-24 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Of course I meant "at least 1" for the original testcase.


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-05-24 17:22 ` paolo.carlini at oracle dot com
@ 2014-07-30 20:07 ` paolo at gcc dot gnu.org
  2014-07-30 20:08 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-07-30 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Jul 30 20:06:29 2014
New Revision: 213310

URL: https://gcc.gnu.org/viewcvs?rev=213310&root=gcc&view=rev
Log:
/cp
2014-07-30  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/57397
    * pt.c (unify_arity): Add boolean parameter.
    (unify_too_few_arguments): Likewise.
    (type_unification_real): Diagnose correctly insufficient
    arguments in the presence of trailing variadic parameters;
    deducing multiple trailing packs as empty is fine.

/testsuite
2014-07-30  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/57397
    * g++.dg/cpp0x/vt-57397-1.C: New.
    * g++.dg/cpp0x/vt-57397-2.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-57397-1.C
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-57397-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/57397] Off-by-one error in diagnostic when calling variadic function template with too few arguments
  2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-07-30 20:07 ` paolo at gcc dot gnu.org
@ 2014-07-30 20:08 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-30 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed.


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

end of thread, other threads:[~2014-07-30 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 12:27 [Bug c++/57397] New: Off-by-one error in diagnostic when calling variadic function template with too few arguments redi at gcc dot gnu.org
2013-05-24 12:34 ` [Bug c++/57397] " paolo.carlini at oracle dot com
2013-05-24 12:43 ` redi at gcc dot gnu.org
2013-05-24 13:19 ` daniel.kruegler at googlemail dot com
2013-05-24 17:20 ` paolo.carlini at oracle dot com
2013-05-24 17:22 ` paolo.carlini at oracle dot com
2014-07-30 20:07 ` paolo at gcc dot gnu.org
2014-07-30 20:08 ` paolo.carlini at oracle dot com

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