This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/8857: template template arguments in conversion functions rejected


>Number:         8857
>Category:       c++
>Synopsis:       template template arguments in conversion functions rejected
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 07 03:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Martin v. Löwis
>Release:        3.1
>Organization:
>Environment:
System: SunOS paros 5.9 Generic_112233-02 sun4u sparc SUNW,Sun-Blade-1000
Architecture: sun4

host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../configure --host=sparc-sun-solaris2.8 --enable-shared --enable-threads --with-cpu=v8 --with-gnu-ld --with-gnu-as --enable-version-specific-runtime-libs
>Description:
The following program is rejected:


template <class T> struct A {
    template <class U> operator U() { return sizeof(U); }
};


template <class T> struct B {
    template <template<class U>class X> operator X<double>() { return X<double>(); }
};

int main() {
  A<double> a;
  B<long> b;
  a = b;
}
>How-To-Repeat:
When compiling this program, the compiler reports

b.cc:7: parse error before `<' token
b.cc:7: syntax error before `<' token
b.cc: In function `int main()':
b.cc:13: no match for `A<double>& = B<long int>&' operator
b.cc:1: candidates are: A<double>& A<double>::operator=(const A<double>&)

>Fix:

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]