c++/7346: templated conversion operator to dependent type

david.abrahams@rcn.com david.abrahams@rcn.com
Wed Jul 17 18:13:00 GMT 2002


>Number:         7346
>Category:       c++
>Synopsis:       templated conversion operator to dependent type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 17 16:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     david.abrahams@rcn.com
>Release:        3.1
>Organization:
>Environment:
Cygwin
>Description:
Should compile, instead gives:

foo.cpp:10: no `X<T>::operator int() const' member function declared in class `
   X<T>'
foo.cpp:10: template definition of non-template `X<T>::operator int() const'
>How-To-Repeat:
template <class T>
struct X
{
    typedef int result_type;
    operator result_type() const;
};

template <class T>
X<T>::operator typename X<T>::result_type() const
{
    return 0;
}

int x = X<char>();

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list