This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8578: cast typename operator
- From: Delana dot Lorenzo at libero dot it
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Nov 2002 06:49:05 -0000
- Subject: c++/8578: cast typename operator
- Reply-to: Delana dot Lorenzo at libero dot it
>Number: 8578
>Category: c++
>Synopsis: cast typename operator
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 13 22:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Delana.Lorenzo@libero.it
>Release: gcc-3.2
>Organization:
>Environment:
Linux
>Description:
#include <iostream>
using namespace std;
template <class K>
class A
{
public:
typedef typename K::val val;
operator val ();
};
template <class K>
A<K>::operator val ()
{
printf ("cast operator\n");
}
struct myval{ typedef int val; };
int
main ()
{
A<myval> a;
(int)a;
}
/* if you define in the class header the cast operator
you don't get error like this:
template_cast_op.cxx:13: warning: `typename A<K>::val' is implicitly a typename
template_cast_op.cxx:13: warning: implicit typename is deprecated, please see
the documentation for details
template_cast_op.cxx:14: no `A<K>::operator K::val()' member function declared
in class `A<K>'
template_cast_op.cxx:14: template definition of non-template `A<K>::operator
K::val()'
*/
>How-To-Repeat:
compile this source code
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: