public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53506] New: Variadic templates in combination with function pointer problem
@ 2012-05-28 9:09 o.mangold at googlemail dot com
2012-05-28 9:32 ` [Bug c++/53506] " redi at gcc dot gnu.org
2021-07-27 7:28 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: o.mangold at googlemail dot com @ 2012-05-28 9:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53506
Bug #: 53506
Summary: Variadic templates in combination with function
pointer problem
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: o.mangold@googlemail.com
The example code below appears to be correct to me, but does not compiler with
g++. I tried it also with Intel compiler 12.1, and icc compiles it just fine.
Neither the first, nor the second version of the call of a() seems to work. It
can't deduce the template args from the function pointer and also does not
accept explicit specification. I had expected at least the second version of
the call to work. Is gcc wrong here or icc?
> icpc -strict-ansi -std=c++0x fpointers.cxx
> g++ -std=c++11 fpointers.cxx
fpointers.cxx: In function ‘int main()’:
fpointers.cxx:17:18: error: no matching function for call to ‘A<int>::a(int
(&)(int, int), int)’
fpointers.cxx:17:18: note: candidate is:
fpointers.cxx:5:3: note: template<class RES, class ... FARGS> static void
A::a(RES (*)(FARGS ..., SARGS ...), FARGS ...) [with RES = RES; FARGS = {FARGS
...}; SARGS = {int}]
fpointers.cxx:5:3: note: template argument deduction/substitution failed:
fpointers.cxx:17:18: note: candidate expects 1 argument, 2 provided
fpointers.cxx:18:27: error: no matching function for call to ‘A<int>::a(int
(&)(int, int), int)’
fpointers.cxx:18:27: note: candidate is:
fpointers.cxx:5:3: note: template<class RES, class ... FARGS> static void
A::a(RES (*)(FARGS ..., SARGS ...), FARGS ...) [with RES = RES; FARGS = {FARGS
...}; SARGS = {int}]
fpointers.cxx:5:3: note: template argument deduction/substitution failed:
fpointers.cxx:18:27: note: candidate expects 1 argument, 2 provided
--- fpointers.cxx ---
template<typename... SARGS>
struct A
{
template<typename RES,typename... FARGS> static void
a(RES(*func)(FARGS...,SARGS...),FARGS...)
{
}
};
int foo(int,int)
{
return 0;
}
int main()
{
A<int>::a(foo,0);
A<int>::a<int,int>(foo,0);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/53506] Variadic templates in combination with function pointer problem
2012-05-28 9:09 [Bug c++/53506] New: Variadic templates in combination with function pointer problem o.mangold at googlemail dot com
@ 2012-05-28 9:32 ` redi at gcc dot gnu.org
2021-07-27 7:28 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-28 9:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53506
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-28 09:31:33 UTC ---
4.6 only rejects the first one:
t.cc: In function 'int main()':
t.cc:17:18: error: no matching function for call to 'A<int>::a(int (&)(int,
int), int)'
t.cc:17:18: note: candidate is:
t.cc:5:3: note: template<class RES, class ... FARGS> static void A::a(RES
(*)(FARGS ..., SARGS ...), FARGS ...) [with RES = RES, FARGS = {FARGS ...},
SARGS = {int}]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/53506] Variadic templates in combination with function pointer problem
2012-05-28 9:09 [Bug c++/53506] New: Variadic templates in combination with function pointer problem o.mangold at googlemail dot com
2012-05-28 9:32 ` [Bug c++/53506] " redi at gcc dot gnu.org
@ 2021-07-27 7:28 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27 7:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |66670
Keywords| |rejects-valid
Last reconfirmed|2017-08-20 00:00:00 |2021-7-27
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note I do think the code is valid , some of this is recorded as PR 66670.
Looks like clang cannot deduce return type still.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66670
[Bug 66670] "template argument deduction/substitution failed" with function
pointers and multiple parameter packs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-27 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28 9:09 [Bug c++/53506] New: Variadic templates in combination with function pointer problem o.mangold at googlemail dot com
2012-05-28 9:32 ` [Bug c++/53506] " redi at gcc dot gnu.org
2021-07-27 7:28 ` 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).