public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16829] New: default parameter can be not one of the last in template function
@ 2004-07-30 3:51 charles at kde dot org
2004-07-30 4:04 ` [Bug c++/16829] " charles at kde dot org
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: charles at kde dot org @ 2004-07-30 3:51 UTC (permalink / raw)
To: gcc-bugs
template <class A>
void foo(A a=0, int b)
{ }
int main() { foo(0, 0); }
Behavior:
compiles (2 warnings on unused vars)
Expected behavior:
Make an error on the a=0 (which isn't the last parameter)
I also got it to ICE (SIGSEGV) on a block of code repeatedly, but try as I
might, cannot reproduce.
This has been reproduced on:
gcc version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
gcc version 3.5.0 20040722 (experimental)
gcc version 3.2.2
--
Summary: default parameter can be not one of the last in
template function
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: charles at kde dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-pc-linux-gnu/3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
@ 2004-07-30 4:04 ` charles at kde dot org
2004-07-30 4:15 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: charles at kde dot org @ 2004-07-30 4:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From charles at kde dot org 2004-07-30 04:04 -------
And now I have the ICE (which may be rather unrelated):
template <class A> void foo(A a, int c=0, int d)
{ }
int main()
{
foo(0);
}
To reproduce this, create a template function in which a parameter has a
default value, but it has a parameter after it without a default value. Then
try to call that template function where the number of parameters passed is
the number of parameters that have no default, up to the one that does have a
default. (whew!)
reproduced on:
gcc version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
2004-07-30 4:04 ` [Bug c++/16829] " charles at kde dot org
@ 2004-07-30 4:15 ` pinskia at gcc dot gnu dot org
2004-07-30 13:20 ` bangerth at dealii dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-30 4:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-30 04:15 -------
Confirmed
: Test is the same (pass) at both endpoints (2000-12-31-trunk,
: 2004-07-28-trunk), so there's nothing for me to do.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2004-07-30 04:15:22
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
2004-07-30 4:04 ` [Bug c++/16829] " charles at kde dot org
2004-07-30 4:15 ` pinskia at gcc dot gnu dot org
@ 2004-07-30 13:20 ` bangerth at dealii dot org
2005-01-25 16:32 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-07-30 13:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-30 13:20 -------
Just for completeness: this is the ICE on the second snippet:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `int main()':
x.cc:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
` (2 preceding siblings ...)
2004-07-30 13:20 ` bangerth at dealii dot org
@ 2005-01-25 16:32 ` pinskia at gcc dot gnu dot org
2005-01-25 17:05 ` Matthieu dot Moy at imag dot fr
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-25 16:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-25 16:31 -------
*** Bug 19625 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |Matthieu dot Moy at imag dot
| |fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
` (3 preceding siblings ...)
2005-01-25 16:32 ` pinskia at gcc dot gnu dot org
@ 2005-01-25 17:05 ` Matthieu dot Moy at imag dot fr
2005-05-09 14:25 ` pinskia at gcc dot gnu dot org
2005-07-06 1:26 ` charles at kde dot org
6 siblings, 0 replies; 12+ messages in thread
From: Matthieu dot Moy at imag dot fr @ 2005-01-25 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From Matthieu dot Moy at imag dot fr 2005-01-25 17:05 -------
Bug 19625 contains two other similar testcases. They're worth trying once the
bug is fixed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
` (4 preceding siblings ...)
2005-01-25 17:05 ` Matthieu dot Moy at imag dot fr
@ 2005-05-09 14:25 ` pinskia at gcc dot gnu dot org
2005-07-06 1:26 ` charles at kde dot org
6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-09 14:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-09 14:22 -------
*** Bug 21467 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |sylvain dot joyeux at m4x
| |dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
` (5 preceding siblings ...)
2005-05-09 14:25 ` pinskia at gcc dot gnu dot org
@ 2005-07-06 1:26 ` charles at kde dot org
6 siblings, 0 replies; 12+ messages in thread
From: charles at kde dot org @ 2005-07-06 1:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From charles at kde dot org 2005-07-06 01:26 -------
I should point out that fixing the actual bug in question will fix the ICE
itself.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
[not found] <bug-16829-3386@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-01-19 9:56 ` reichelt at gcc dot gnu dot org
@ 2006-01-19 10:01 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-01-19 10:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from reichelt at gcc dot gnu dot org 2006-01-19 10:01 -------
Subject: Bug 16829
Author: reichelt
Date: Thu Jan 19 10:01:20 2006
New Revision: 109953
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109953
Log:
PR c++/16829
* decl.c (start_preparsed_function): Check default arguments
unconditionally.
* name-lookup.c (pushdecl_maybe_friend): Check default arguments
of all functions and function templates.
* parser.c (cp_parser_late_parsing_default_args): Check default
arguments.
* decl2.c (check_default_args): Set missing default arguments to
error_mark_node.
* g++.dg/other/default2.C: New test.
* g++.dg/other/default3.C: New test.
Added:
branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/default2.C
branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/default3.C
Modified:
branches/gcc-4_0-branch/gcc/cp/ChangeLog
branches/gcc-4_0-branch/gcc/cp/decl.c
branches/gcc-4_0-branch/gcc/cp/decl2.c
branches/gcc-4_0-branch/gcc/cp/name-lookup.c
branches/gcc-4_0-branch/gcc/cp/parser.c
branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
[not found] <bug-16829-3386@http.gcc.gnu.org/bugzilla/>
2005-12-17 19:55 ` reichelt at gcc dot gnu dot org
2006-01-19 9:52 ` reichelt at gcc dot gnu dot org
@ 2006-01-19 9:56 ` reichelt at gcc dot gnu dot org
2006-01-19 10:01 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-01-19 9:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from reichelt at gcc dot gnu dot org 2006-01-19 09:56 -------
Subject: Bug 16829
Author: reichelt
Date: Thu Jan 19 09:56:44 2006
New Revision: 109952
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109952
Log:
PR c++/16829
* decl.c (start_preparsed_function): Check default arguments
unconditionally.
* name-lookup.c (pushdecl_maybe_friend): Check default arguments
of all functions and function templates.
* parser.c (cp_parser_late_parsing_default_args): Check default
arguments.
* decl2.c (check_default_args): Set missing default arguments to
error_mark_node.
* g++.dg/other/default2.C: New test.
* g++.dg/other/default3.C: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/default2.C
branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/default3.C
Modified:
branches/gcc-4_1-branch/gcc/cp/ChangeLog
branches/gcc-4_1-branch/gcc/cp/decl.c
branches/gcc-4_1-branch/gcc/cp/decl2.c
branches/gcc-4_1-branch/gcc/cp/name-lookup.c
branches/gcc-4_1-branch/gcc/cp/parser.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
[not found] <bug-16829-3386@http.gcc.gnu.org/bugzilla/>
2005-12-17 19:55 ` reichelt at gcc dot gnu dot org
@ 2006-01-19 9:52 ` reichelt at gcc dot gnu dot org
2006-01-19 9:56 ` reichelt at gcc dot gnu dot org
2006-01-19 10:01 ` reichelt at gcc dot gnu dot org
3 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-01-19 9:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from reichelt at gcc dot gnu dot org 2006-01-19 09:52 -------
Subject: Bug 16829
Author: reichelt
Date: Thu Jan 19 09:51:57 2006
New Revision: 109950
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109950
Log:
PR c++/16829
* decl.c (start_preparsed_function): Check default arguments
unconditionally.
* name-lookup.c (pushdecl_maybe_friend): Check default arguments
of all functions and function templates.
* parser.c (cp_parser_late_parsing_default_args): Check default
arguments.
* decl2.c (check_default_args): Set missing default arguments to
error_mark_node.
* g++.dg/other/default2.C: New test.
* g++.dg/other/default3.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/other/default2.C
trunk/gcc/testsuite/g++.dg/other/default3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/cp/decl2.c
trunk/gcc/cp/name-lookup.c
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/16829] default parameter can be not one of the last in template function
[not found] <bug-16829-3386@http.gcc.gnu.org/bugzilla/>
@ 2005-12-17 19:55 ` reichelt at gcc dot gnu dot org
2006-01-19 9:52 ` reichelt at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-17 19:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from reichelt at gcc dot gnu dot org 2005-12-17 19:55 -------
Working on a patch.
--
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |reichelt at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16829
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-01-19 10:01 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-30 3:51 [Bug c++/16829] New: default parameter can be not one of the last in template function charles at kde dot org
2004-07-30 4:04 ` [Bug c++/16829] " charles at kde dot org
2004-07-30 4:15 ` pinskia at gcc dot gnu dot org
2004-07-30 13:20 ` bangerth at dealii dot org
2005-01-25 16:32 ` pinskia at gcc dot gnu dot org
2005-01-25 17:05 ` Matthieu dot Moy at imag dot fr
2005-05-09 14:25 ` pinskia at gcc dot gnu dot org
2005-07-06 1:26 ` charles at kde dot org
[not found] <bug-16829-3386@http.gcc.gnu.org/bugzilla/>
2005-12-17 19:55 ` reichelt at gcc dot gnu dot org
2006-01-19 9:52 ` reichelt at gcc dot gnu dot org
2006-01-19 9:56 ` reichelt at gcc dot gnu dot org
2006-01-19 10:01 ` reichelt at gcc dot gnu dot 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).