public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected
@ 2011-12-18 22:18 pkmx.tw at gmail dot com
2011-12-29 7:38 ` [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pkmx.tw at gmail dot com @ 2011-12-18 22:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
Bug #: 51613
Summary: Ambiguous function template instantiations as template
argument are not rejected
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pkmx.tw@gmail.com
In the book "C++ Templates - The Complete Guide" section 8.3, the following
code snippet is given:
template<typename F, typename T>
void apply(F f, T t)
{
f(t);
}
template<typename T>
void multi(T)
{
}
template<typename T>
void multi(T*)
{
}
int main()
{
apply(&multi<int>, 7);
return 0;
}
My understanding is that &multi<int> here instantiates two functions of types
void (*)(int) and void (*)(int*) with no ways to disambiguate and therefore F
cannot be deducted. However, gcc currently deducts F as void (*)(int) and
ultimately calls multi(int). This is the same case for gcc 4.4.3, gcc 4.6.2,
gcc 4.7.0 20111112 snapshot and probably other versions.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] Ambiguous function template instantiations as template argument are not rejected
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
@ 2011-12-29 7:38 ` pinskia at gcc dot gnu.org
2012-01-04 13:47 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-29 7:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Known to work| |4.3.5
Keywords| |accepts-invalid
Last reconfirmed| |2011-12-29
Ever Confirmed|0 |1
Summary|Ambiguous function template |[4.4/4.5/4.6/4.7
|instantiations as template |Regression] Ambiguous
|argument are not rejected |function template
| |instantiations as template
| |argument are not rejected
Target Milestone|--- |4.4.7
Known to fail| |4.4.5, 4.7.0
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-29 06:07:16 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] Ambiguous function template instantiations as template argument are not rejected
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
2011-12-29 7:38 ` [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] " pinskia at gcc dot gnu.org
@ 2012-01-04 13:47 ` rguenth at gcc dot gnu.org
2012-01-11 13:50 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-04 13:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Priority|P3 |P2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] Ambiguous function template instantiations as template argument are not rejected
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
2011-12-29 7:38 ` [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] " pinskia at gcc dot gnu.org
2012-01-04 13:47 ` rguenth at gcc dot gnu.org
@ 2012-01-11 13:50 ` jason at gcc dot gnu.org
2012-01-11 16:47 ` jason at gcc dot gnu.org
2012-01-11 20:40 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-11 13:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] Ambiguous function template instantiations as template argument are not rejected
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
` (2 preceding siblings ...)
2012-01-11 13:50 ` jason at gcc dot gnu.org
@ 2012-01-11 16:47 ` jason at gcc dot gnu.org
2012-01-11 20:40 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-11 16:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-11 16:47:05 UTC ---
Author: jason
Date: Wed Jan 11 16:46:57 2012
New Revision: 183099
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183099
Log:
PR c++/51613
* pt.c (resolve_overloaded_unification): Compare types with
same_type_p, not decls_match.
Added:
trunk/gcc/testsuite/g++.dg/template/explicit-args5.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] Ambiguous function template instantiations as template argument are not rejected
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
` (3 preceding siblings ...)
2012-01-11 16:47 ` jason at gcc dot gnu.org
@ 2012-01-11 20:40 ` jason at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2012-01-11 20:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51613
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|4.4.7 |4.7.0
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-01-11 20:39:45 UTC ---
Fixed for 4.7. Not backporting fixes for invalid code bugs.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-11 20:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-18 22:18 [Bug c++/51613] New: Ambiguous function template instantiations as template argument are not rejected pkmx.tw at gmail dot com
2011-12-29 7:38 ` [Bug c++/51613] [4.4/4.5/4.6/4.7 Regression] " pinskia at gcc dot gnu.org
2012-01-04 13:47 ` rguenth at gcc dot gnu.org
2012-01-11 13:50 ` jason at gcc dot gnu.org
2012-01-11 16:47 ` jason at gcc dot gnu.org
2012-01-11 20:40 ` jason 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).