public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* gcc 3.3.3 bug(?): "ambiguous class template instantiation"
@ 2004-05-12 23:00 david
  2004-05-13 15:26 ` gcc 3.3.3 bug( #9737 ?): " david
  0 siblings, 1 reply; 3+ messages in thread
From: david @ 2004-05-12 23:00 UTC (permalink / raw)
  To: gcc-bugs

Hallo,

The following code does not compile with gcc 3.3.3 
but compiles fine with comeau.
Has anybody a fix or can help?

David

-------------------
#include <list>
#include <string>

template< typename TTarget, class TSource >
struct test;


template< typename TTarget, typename TCh, class TTr, class TAl >
struct test< TTarget, std::basic_string<TCh,TTr,TAl> > {
    static TTarget f()
        {
            return TTarget();
        }
};

template< typename TTarget, class TString, class TAl, template<class,class> 
class TCont >
struct test< TTarget, TCont<TString,TAl> > {
    static TTarget f()
        {
            return TTarget();
        }
};

template< typename TTarget, class TSource >
TTarget do_test(const TSource&)
{
    return test<TTarget,TSource>::f();
}

int main()
{
    std::string s;
    std::list<std::string> l;
    int i1 = do_test<int>(s);
    int i2 = do_test<int>(l);
    return i1+i2;
}
---------------------------

The gcc error is: 


test.cpp: In function `TTarget do_test(const TSource&) [with TTarget = int,
   TSource = std::string]':
test.cpp:34:   instantiated from here
test.cpp:27: error: ambiguous class template instantiation for `struct
   test<int, std::string>'
test.cpp:17: error: candidates are: struct test<TTarget, TCont<TString, TAl> 
>
test.cpp:9: error:                 struct test<TTarget, 
std::basic_string<TCh,
   TTr, TAl> >
test.cpp:27: error: incomplete type 'test<int, std::string>' cannot be used 
to
   name a scope



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

* Re: gcc 3.3.3 bug( #9737 ?): "ambiguous class template instantiation"
  2004-05-12 23:00 gcc 3.3.3 bug(?): "ambiguous class template instantiation" david
@ 2004-05-13 15:26 ` david
  2004-05-17 13:44   ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: david @ 2004-05-13 15:26 UTC (permalink / raw)
  To: gcc-bugs


This seems to be the same bug as: 

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

This is already a year old. Is there a workaround for this?

David




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

* Re: gcc 3.3.3 bug( #9737 ?): "ambiguous class template instantiation"
  2004-05-13 15:26 ` gcc 3.3.3 bug( #9737 ?): " david
@ 2004-05-17 13:44   ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2004-05-17 13:44 UTC (permalink / raw)
  To: david; +Cc: gcc-bugs

david wrote:
> This seems to be the same bug as: 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9737
> This is already a year old. Is there a workaround for this?

We don't track bugs reported via mail to gcc-bugs.  You are better off 
if you file bug reports into our bugzilla bug database.  See
   http://gcc.gnu.org/bugs.html
for more info on reporting bugs.

If you want to ask about status of a current bug report, then add a 
comment to that bug report asking the question.  This is more likely to 
get a response than sending mail to gcc-bugs.

I am not a C++ expert, but from a quick look at bug 9737, it appears 
that the ISO C++ language committee has decided that a C++ compiler is 
not required to make this testcase work, however, it is allowed as an 
extension to the C++ language.  See Defect Report 150.  Gcc does not 
implement this extension yet.  Since we rely on volunteers for most of 
our work, there is no way to say when this extension will be implemented 
in gcc.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

end of thread, other threads:[~2004-05-17  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-12 23:00 gcc 3.3.3 bug(?): "ambiguous class template instantiation" david
2004-05-13 15:26 ` gcc 3.3.3 bug( #9737 ?): " david
2004-05-17 13:44   ` Jim Wilson

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