public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17225] New: Trsolver picks universal template over user-defined conversion
@ 2004-08-29 11:27 igodard at pacbell dot net
  2004-08-29 14:47 ` [Bug c++/17225] " giovannibajo at libero dot it
  0 siblings, 1 reply; 2+ messages in thread
From: igodard at pacbell dot net @ 2004-08-29 11:27 UTC (permalink / raw)
  To: gcc-bugs

I'm not sure this is a bug or just my ignorance of the rules.
#include <iostream>
struct R{};
struct S{};
struct T{
    operator R() {return e;}
    operator S() {return f;}
    R e;
    S f;
    };

void Bar(R r) { std::cerr << "Bar\n"; }
void Foo(S s) { std::cerr << "Foo direct\n";}
template<typename U>
void Foo(U u) { std::cerr << "Foo template\n"; }
int main() {
    T t;
    S s;
    Bar(t);
    Foo(s);
    Foo(t);
    }

gets you:

~/ootbc/common/test/src$ a.out
Bar
Foo direct
Foo template

That is, it takes exact match over universal template, and universal template over user-defined conversion. Is this right>

Ivan

-- 
           Summary: Trsolver picks universal template over user-defined
                    conversion
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/17225] Trsolver picks universal template over user-defined conversion
  2004-08-29 11:27 [Bug c++/17225] New: Trsolver picks universal template over user-defined conversion igodard at pacbell dot net
@ 2004-08-29 14:47 ` giovannibajo at libero dot it
  0 siblings, 0 replies; 2+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-29 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-29 14:47 -------
Yes, GCC is correct.

Please, do not use bugreports as a fallback to learn C++. If you have questions 
about language rules, why don't you use one of hundreds of forum on Internet? I 
can suggest you a newsgroup, comp.lang.c++.moderated, for instance.

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


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


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

end of thread, other threads:[~2004-08-29 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-29 11:27 [Bug c++/17225] New: Trsolver picks universal template over user-defined conversion igodard at pacbell dot net
2004-08-29 14:47 ` [Bug c++/17225] " giovannibajo at libero dot it

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).