public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57678] New: too many errors for bad template parameter
@ 2013-06-22 19:47 manu at gcc dot gnu.org
2015-03-25 17:56 ` [Bug c++/57678] " paolo.carlini at oracle dot com
2021-08-02 3:12 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2013-06-22 19:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57678
Bug ID: 57678
Summary: too many errors for bad template parameter
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
template<int N> int foo(int a) { return N; }
void bar(void)
{
foo<x>(5);
}
triggers:
test.cpp:5:9: error: ‘x’ was not declared in this scope
foo<x>(5);
^
test.cpp:5:13: error: no matching function for call to ‘foo(int)’
foo<x>(5);
^
test.cpp:5:13: note: candidate is:
test.cpp:1:21: note: template<int N> int foo(int)
template<int N> int foo(int a) { return N; }
^
test.cpp:1:21: note: template argument deduction/substitution failed:
test.cpp:5:13: error: template argument 1 is invalid
foo<x>(5);
^
The second error is not useful (and the last "error" should be a note), why
even try to match the function call if the template argument was invalid?
Is there any case where the template argument is invalid and the invalidity is
not triggered by a previous error?
Clang:
test.cpp:5:9: error: use of undeclared identifier 'x'
foo<x>(5);
^
>From gcc-bugs-return-424858-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jun 22 20:46:52 2013
Return-Path: <gcc-bugs-return-424858-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12577 invoked by alias); 22 Jun 2013 20:46:52 -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 12488 invoked by uid 48); 22 Jun 2013 20:46:42 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57678] too many errors for bad template parameter
Date: Sat, 22 Jun 2013 20:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
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:
Message-ID: <bug-57678-4-FWw38RlFiA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57678-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57678-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-06/txt/msg01237.txt.bz2
Content-length: 422
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW678
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is due to once a undeclared decl has been found, its type becomes
int which I think is just wrong. We should use error_mark_node and then handle
the fall out from there.
There have been a few bugs with errors like this which points to the same issue
of treating undeclared decls as ints.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57678] too many errors for bad template parameter
2013-06-22 19:47 [Bug c++/57678] New: too many errors for bad template parameter manu at gcc dot gnu.org
@ 2015-03-25 17:56 ` paolo.carlini at oracle dot com
2021-08-02 3:12 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-25 17:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57678
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-03-25
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57678] too many errors for bad template parameter
2013-06-22 19:47 [Bug c++/57678] New: too many errors for bad template parameter manu at gcc dot gnu.org
2015-03-25 17:56 ` [Bug c++/57678] " paolo.carlini at oracle dot com
@ 2021-08-02 3:12 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02 3:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57678
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2015-09-08 00:00:00 |2021-8-1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Clang and ICC produce one error message.
GCC and MSVC produce two error messages.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-02 3:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 19:47 [Bug c++/57678] New: too many errors for bad template parameter manu at gcc dot gnu.org
2015-03-25 17:56 ` [Bug c++/57678] " paolo.carlini at oracle dot com
2021-08-02 3:12 ` 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).