public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
@ 2006-08-21 17:13 ` pinskia at gcc dot gnu dot org
  2006-10-09 14:16 ` v dot haisman at sh dot cvut dot cz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-21 17:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-08-21 17:13 -------
*** Bug 28793 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |suzev dot kirill at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
  2006-08-21 17:13 ` [Bug c++/5458] address of overloaded template function as argument for template pinskia at gcc dot gnu dot org
@ 2006-10-09 14:16 ` v dot haisman at sh dot cvut dot cz
  2007-08-06 13:59 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2006-10-09 14:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from v dot haisman at sh dot cvut dot cz  2006-10-09 14:16 -------
Shouldn't the "Known to fail" field get all the versions from its duplicates
copied? Maybe that is why this rejects-valid bug is still not fixed even though
most other rejects-valid bugs get a lot of attention and get fixed usually
pretty fast, IMHO.

2.95.3 3.0.4 4.0.0 4.1.0 4.2.0 3.3.3 3.2.3


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
  2006-08-21 17:13 ` [Bug c++/5458] address of overloaded template function as argument for template pinskia at gcc dot gnu dot org
  2006-10-09 14:16 ` v dot haisman at sh dot cvut dot cz
@ 2007-08-06 13:59 ` pinskia at gcc dot gnu dot org
  2007-08-06 14:19 ` rodolfo at rodsoft dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-06 13:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2007-08-06 13:58 -------
*** Bug 33004 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rodolfo at rodsoft dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-08-06 13:59 ` pinskia at gcc dot gnu dot org
@ 2007-08-06 14:19 ` rodolfo at rodsoft dot org
  2008-01-07 21:45 ` v dot haisman at sh dot cvut dot cz
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: rodolfo at rodsoft dot org @ 2007-08-06 14:19 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 422 bytes --]



------- Comment #12 from rodolfo at rodsoft dot org  2007-08-06 14:18 -------
This is an yet simpler case where this bug shows up:

template <class T> void foo(T);
void foo(int);

void bar()
{
    &foo;
}

i686-pc-linux-gnu-g++-4.2.1 fails with:

teste.cpp: In function ‘void bar()’:
teste.cpp:6: error: statement cannot resolve address of overloaded function


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-08-06 14:19 ` rodolfo at rodsoft dot org
@ 2008-01-07 21:45 ` v dot haisman at sh dot cvut dot cz
  2009-11-25  2:55 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2008-01-07 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from v dot haisman at sh dot cvut dot cz  2008-01-07 20:47 -------
This still fails in 4.3.0. Know to fail sorted and without duplicates should
read: 2.95.3 3.0.4 3.2.3 3.3.3 4.0.0 4.1.0 4.2.0 4.3.0


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2008-01-07 21:45 ` v dot haisman at sh dot cvut dot cz
@ 2009-11-25  2:55 ` jason at gcc dot gnu dot org
  2010-01-21 18:38 ` joseph dot h dot garvin at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-25  2:55 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]



------- Comment #14 from jason at gcc dot gnu dot org  2009-11-25 02:55 -------
I'm not sure the standard actually says that this is well-formed, though it
seems reasonable to me.

13.4/2: If the name is a function template, template argument deduction is done
(14.9.2.2), and if the argument deduction succeeds, the resulting template
argument list is used to generate a single function template specialization,
which is added to the set of overloaded functions considered.

14.9.2.2: The function template’s function type and the specified type are used
as the types of P and A, and the deduction is done as described in 14.9.2.5.

It's not entirely clear that there is a "specified type" for this kind of
two-way deduction.  EDG also rejects this.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2009-11-25  2:55 ` jason at gcc dot gnu dot org
@ 2010-01-21 18:38 ` joseph dot h dot garvin at gmail dot com
  2010-01-21 19:00 ` jwakely dot gcc at gmail dot com
  2010-01-21 19:09 ` jason at gcc dot gnu dot org
  8 siblings, 0 replies; 16+ messages in thread
From: joseph dot h dot garvin at gmail dot com @ 2010-01-21 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from joseph dot h dot garvin at gmail dot com  2010-01-21 18:38 -------
I'm not sure what the standard says, but conceptually, if you only provide a
template generic template foo, with no non-templated foo defined, then
instantiations of foo are *never* 'overloaded.' If I have:

template<int n>
void foo() {}

Then foo<3> is a distinct function from foo<2>. It doesn't make sense to refer
to foo as overloaded (unless there is also a non-templated foo defined). foo<3>
has a single unique address, there is no ambiguity. Automatically considering
it an overloaded function (as I suspect GCC must be doing internally) leads to
a confusing error when compiling this snippet:

#include <iostream>

template<int n>
void foo() {}

int main()
{
        &foo;
}

You get the same error about not being able to resolve foo because it's
overloaded. But foo isn't a function at this point. It's a template. And no
template parameters have been filled in. I should get an error about expecting
angle brackets.


-- 

joseph dot h dot garvin at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph dot h dot garvin at
                   |                            |gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2010-01-21 18:38 ` joseph dot h dot garvin at gmail dot com
@ 2010-01-21 19:00 ` jwakely dot gcc at gmail dot com
  2010-01-21 19:09 ` jason at gcc dot gnu dot org
  8 siblings, 0 replies; 16+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2010-01-21 19:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jwakely dot gcc at gmail dot com  2010-01-21 19:00 -------
Shouldn't it get the same error as for this case?

template<class T>
T foo() { return T(); }

int main()
{
        &foo;
}

That example can be made valid like so:

        int (*pf)() = &foo;

Which demonstrates that the angle brackets are not necessary, *if* the compiler
can determine which specialisation is intended.  So the "cannot resolve address
of overloaded function" error is arguably correct.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-01-21 19:00 ` jwakely dot gcc at gmail dot com
@ 2010-01-21 19:09 ` jason at gcc dot gnu dot org
  8 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-21 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jason at gcc dot gnu dot org  2010-01-21 19:09 -------
We describe a template as overloading itself since it represents any number of
actual functions.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
                   ` (5 preceding siblings ...)
  2004-08-27 13:27 ` bangerth at dealii dot org
@ 2004-09-26 20:56 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26 20:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 20:56 -------
*** Bug 17683 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |v dot haisman at sh dot cvut
                   |                            |dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
                   ` (4 preceding siblings ...)
  2004-08-18 12:58 ` bangerth at dealii dot org
@ 2004-08-27 13:27 ` bangerth at dealii dot org
  2004-09-26 20:56 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-08-27 13:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-27 13:27 -------
*** Bug 17208 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |igodard at pacbell dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
                   ` (3 preceding siblings ...)
  2004-08-18  2:23 ` pinskia at gcc dot gnu dot org
@ 2004-08-18 12:58 ` bangerth at dealii dot org
  2004-08-27 13:27 ` bangerth at dealii dot org
  2004-09-26 20:56 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 16+ messages in thread
From: bangerth at dealii dot org @ 2004-08-18 12:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-18 12:58 -------
PR 17071 has this very nice and clean testcase.  
-------------- 
int foo (int); 
template <class T> T foo (T, T); 
 
template <class T, class U> int bar (T, U); 
 
int main () 
{ 
    bar (0, &foo); 
} 
--------------------- 
 
W.  

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
                   ` (2 preceding siblings ...)
  2004-05-16 22:27 ` pinskia at gcc dot gnu dot org
@ 2004-08-18  2:23 ` pinskia at gcc dot gnu dot org
  2004-08-18 12:58 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-18  2:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-18 02:23 -------
*** Bug 17071 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sebor at roguewave dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
  2004-01-31 19:07 ` pinskia at gcc dot gnu dot org
  2004-01-31 19:08 ` pinskia at gcc dot gnu dot org
@ 2004-05-16 22:27 ` pinskia at gcc dot gnu dot org
  2004-08-18  2:23 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-16 22:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-15 21:27 -------
*** Bug 15469 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |relf at os2 dot ru


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
  2004-01-31 19:07 ` pinskia at gcc dot gnu dot org
@ 2004-01-31 19:08 ` pinskia at gcc dot gnu dot org
  2004-05-16 22:27 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-31 19:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-31 19:08 -------
*** Bug 13947 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |debian-gcc at lists dot
                   |                            |debian dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug c++/5458] address of overloaded template function as argument for template
       [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
@ 2004-01-31 19:07 ` pinskia at gcc dot gnu dot org
  2004-01-31 19:08 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-31 19:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-31 19:06 -------
Here is a simple testcase:
template <class T> class vector{};
template <class T> vector <T> foo(vector <T>) {}
void foo(int) {}
float foo(float) {}
template <class T_arg, class T_result>
void ptr_fun(T_result (*f)(T_arg)) {}
main() { ptr_fun<float>(foo);   }

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5458


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-01-21 19:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-5458-2793@http.gcc.gnu.org/bugzilla/>
2006-08-21 17:13 ` [Bug c++/5458] address of overloaded template function as argument for template pinskia at gcc dot gnu dot org
2006-10-09 14:16 ` v dot haisman at sh dot cvut dot cz
2007-08-06 13:59 ` pinskia at gcc dot gnu dot org
2007-08-06 14:19 ` rodolfo at rodsoft dot org
2008-01-07 21:45 ` v dot haisman at sh dot cvut dot cz
2009-11-25  2:55 ` jason at gcc dot gnu dot org
2010-01-21 18:38 ` joseph dot h dot garvin at gmail dot com
2010-01-21 19:00 ` jwakely dot gcc at gmail dot com
2010-01-21 19:09 ` jason at gcc dot gnu dot org
     [not found] <20020122162601.5458.kenelson@ece.ucdavis.edu>
2004-01-31 19:07 ` pinskia at gcc dot gnu dot org
2004-01-31 19:08 ` pinskia at gcc dot gnu dot org
2004-05-16 22:27 ` pinskia at gcc dot gnu dot org
2004-08-18  2:23 ` pinskia at gcc dot gnu dot org
2004-08-18 12:58 ` bangerth at dealii dot org
2004-08-27 13:27 ` bangerth at dealii dot org
2004-09-26 20:56 ` 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).