public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37088] New: Functions with default parameters not correctly handled inside templates.
@ 2008-08-11 22:40 tmsriram at google dot com
2008-08-11 22:46 ` [Bug c++/37088] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tmsriram at google dot com @ 2008-08-11 22:40 UTC (permalink / raw)
To: gcc-bugs
For this simple program (test.cc):
-------------------------------------------------------------------------
template <typename Pred>
void AssertPred(Pred pred) {
pred("x", "y");
}
bool pred4(const char *, const char *, const char *x = "", const char *y = "");
bool pred2(const char *, const char *);
void foof() {
AssertPred(pred2);
AssertPred(pred4);
}
-----------------------------------------------------------------------------
> $gcc421 -c test.ii (Success with gcc-4.2.1)
> $gcc431 -c test.ii (Failure with gcc-4.3.1)
test.ii: In function 'void AssertPred(Pred) [with Pred = bool (*)(const char*,
const char*, const char*, const char*)]':
test.ii: instantiated from here
test.ii: error: too few arguments to function
--
Summary: Functions with default parameters not correctly handled
inside templates.
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tmsriram at google dot com
GCC build triplet: x86_64
GCC host triplet: x86_64
GCC target triplet: x86_64
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37088
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/37088] Functions with default parameters not correctly handled inside templates.
2008-08-11 22:40 [Bug c++/37088] New: Functions with default parameters not correctly handled inside templates tmsriram at google dot com
@ 2008-08-11 22:46 ` pinskia at gcc dot gnu dot org
2008-08-13 16:22 ` bangerth at dealii dot org
2009-02-10 22:04 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-11 22:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-08-11 22:45 -------
Hmm, I don't think default parameters are taken into account with function
pointers. I think this was a GCC "undocumented extension" (aka bug) that was
fixed in 4.3.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37088
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/37088] Functions with default parameters not correctly handled inside templates.
2008-08-11 22:40 [Bug c++/37088] New: Functions with default parameters not correctly handled inside templates tmsriram at google dot com
2008-08-11 22:46 ` [Bug c++/37088] " pinskia at gcc dot gnu dot org
@ 2008-08-13 16:22 ` bangerth at dealii dot org
2009-02-10 22:04 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: bangerth at dealii dot org @ 2008-08-13 16:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from bangerth at dealii dot org 2008-08-13 16:21 -------
(In reply to comment #0)
> bool pred4(const char *, const char *, const char *x = "", const char *y = "");
The type of pred4 is still
bool (*) (const char *, const char *, const char *x, const char *)
and so when you pass this function through a pointer it can't be called with
only two parameters.
Andrew is right that this used to be one of the many ill-conceived gcc
extensions.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37088
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/37088] Functions with default parameters not correctly handled inside templates.
2008-08-11 22:40 [Bug c++/37088] New: Functions with default parameters not correctly handled inside templates tmsriram at google dot com
2008-08-11 22:46 ` [Bug c++/37088] " pinskia at gcc dot gnu dot org
2008-08-13 16:22 ` bangerth at dealii dot org
@ 2009-02-10 22:04 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-10 22:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-02-10 22:03 -------
*** Bug 39136 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fang at csl dot cornell dot
| |edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37088
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-10 22:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-11 22:40 [Bug c++/37088] New: Functions with default parameters not correctly handled inside templates tmsriram at google dot com
2008-08-11 22:46 ` [Bug c++/37088] " pinskia at gcc dot gnu dot org
2008-08-13 16:22 ` bangerth at dealii dot org
2009-02-10 22:04 ` pinskia 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).