public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9898: Template cast operator fo template class
@ 2003-03-21 14:32 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2003-03-21 14:32 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nathan, nobody, philippeb

Synopsis: Template cast operator fo template class

Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Fri Mar 21 14:32:37 2003
Responsible-Changed-Why:
    patching

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9898


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

* Re: c++/9898: Template cast operator fo template class
@ 2003-03-05 22:13 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-03-05 22:13 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, philippeb

Synopsis: Template cast operator fo template class

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Mar  5 22:13:06 2003
State-Changed-Why:
    Confirmed. Never worked with gcc.
    
    The error message also seems botched up, which is the same
    problem as what I mentioned in the audit trail of PR 9807.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9898


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

* c++/9898: Template cast operator fo template class
@ 2003-03-02  1:36 philippeb
  0 siblings, 0 replies; 3+ messages in thread
From: philippeb @ 2003-03-02  1:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9898
>Category:       c++
>Synopsis:       Template cast operator fo template class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 02 01:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     gcc
>Release:        3.0.4
>Organization:
>Environment:
Debian Linux 2.2.19
>Description:
GCC cannot compile the following:

#include <iostream>


using namespace std;


template <typename T>
	struct Wrapper
	{
		template <typename U>
			operator Wrapper<U> const & ()
			{
			}
	};


inline void foo(Wrapper<int> const &)
{
	cout << __PRETTY_FUNCTION__ << endl;
}


int main()
{
	foo(Wrapper<long>());
}


Ouputs:

templatetemplate.cpp: In function `int main()':
templatetemplate.cpp:25: could not convert `{}' to `const Wrapper<int>&'
templatetemplate.cpp:18: in passing argument 1 of `void foo(const Wrapper<int>&)'
>How-To-Repeat:

>Fix:
- Transform Wrapper<> into non-template class Wrapper.
- Remove the reference (&) returned by the cast operator.
- Overload the cast operator to return Wrapper<int> const &.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-21 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 14:32 c++/9898: Template cast operator fo template class nathan
  -- strict thread matches above, loose matches on Subject: below --
2003-03-05 22:13 bangerth
2003-03-02  1:36 philippeb

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