public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11338] New: Function template overload resolution failure
@ 2003-06-26 21:16 mstaley at lanl dot gov
  2003-06-26 22:06 ` [Bug c++/11338] [3.3/3.4 Regression] [DR 214] " bangerth at dealii dot org
  0 siblings, 1 reply; 2+ messages in thread
From: mstaley at lanl dot gov @ 2003-06-26 21:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Function template overload resolution failure
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mstaley at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org

(I tried to enter this bug report into Bugzilla yesterday, but it apparently
didn't get entered. This is the first time I've used Bugzilla, and I apologize
in advance if this bug gets entered twice.)

The following code does not compile with g++ 3.3, or with g++ 3.4 (with the new
parser, right?), which my sysadmin installed from the CVS repository on June 25.
I'm running on a Linux box with Red Hat 9.

     #include <iostream>

     template<int n>
     class bar {
     };

     template<class T>
     T fun(const bar<1> &)
     {
        std::cout << "fun #1" << std::endl;
        return T();
     }

     template<class T, class BAR>
     T fun(const BAR &)
     {
        std::cout << "fun #2" << std::endl;
        return T();
     }

     int main(void)
     {
        fun<double>(bar<1>());  // isn't fun #1 the better match?
        fun<double>(bar<2>());
     }

My take is that this is legal C++, with "fun #1" being the better match for the
first call in the body of main(). G++ says this call is ambiguous. Incidentally,
the Intel C++ compiler also reported an error; however, Metrowerks C++ and KAI
C++ (the latter of which in my experience is usually correct) DID compile this
code.

Okay, what's the verdict?


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

* [Bug c++/11338] [3.3/3.4 Regression] [DR 214] Function template overload resolution failure
  2003-06-26 21:16 [Bug c++/11338] New: Function template overload resolution failure mstaley at lanl dot gov
@ 2003-06-26 22:06 ` bangerth at dealii dot org
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth at dealii dot org @ 2003-06-26 22:06 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE
            Summary|Function template overload  |[3.3/3.4 Regression] [DR
                   |resolution failure          |214] Function template
                   |                            |overload resolution failure


------- Additional Comments From bangerth at dealii dot org  2003-06-26 22:06 -------
This is a duplicate of 4672. It's indeed a bug in gcc.
W.

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


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

end of thread, other threads:[~2003-06-26 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-26 21:16 [Bug c++/11338] New: Function template overload resolution failure mstaley at lanl dot gov
2003-06-26 22:06 ` [Bug c++/11338] [3.3/3.4 Regression] [DR 214] " bangerth at dealii 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).