public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36805]  New: compilation fails when pointer to template-functions are returned by ?-operator
@ 2008-07-11  9:57 rbuergel at web dot de
  2008-12-27 22:10 ` [Bug c++/36805] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: rbuergel at web dot de @ 2008-07-11  9:57 UTC (permalink / raw)
  To: gcc-bugs

The following program fails to compile:

template<typename T> void f()
{}

void g1() {}
void g2() {}

typedef void(*ptrType)();

int main(int argc, char** argv)
{
        ptrType p = argc == 1 ? &f<char> : &f<int>; //<-- error
        ptrType p2 = argc == 1 ? &g1 : &g2;

        ptrType p1;
        if (argc== 1)
                p1 = &f<char>;
        else
                p1 = &f<int>;
}

fptr.cpp:11: error: address of overloaded function with no contextual type
information

As f<char> and f<int> are the same pointer-type, this shouldn't fail. It
doesn't fail for non-template-functions and it aslo doesn't fail if an
if/else-clause is used.


tried with gcc-4.3.1, 4.2.4 and 4.1.2 on x86_64 and 4.2.3 on powerpc-uclibc


-- 
           Summary: compilation fails when pointer to template-functions are
                    returned by ?-operator
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rbuergel at web dot de


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


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

* [Bug c++/36805] compilation fails when pointer to template-functions are returned by ?-operator
  2008-07-11  9:57 [Bug c++/36805] New: compilation fails when pointer to template-functions are returned by ?-operator rbuergel at web dot de
@ 2008-12-27 22:10 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-27 22:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-27 22:05 -------


*** This bug has been marked as a duplicate of 11407 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2008-12-27 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-11  9:57 [Bug c++/36805] New: compilation fails when pointer to template-functions are returned by ?-operator rbuergel at web dot de
2008-12-27 22:10 ` [Bug c++/36805] " 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).