This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
References to Template classes and user type conversions
- To: gcc-bugs at gcc dot gnu dot org
- Subject: References to Template classes and user type conversions
- From: Thomas E Deweese <deweese at kodak dot com>
- Date: Tue, 2 Nov 1999 15:54:44 -0500 (EST)
Hi all,
I discovered a bug in the way user type conversions are handled
for references to template classes. In the following example 'f3'
will fail to compile. However, if you remove it (by defining 'WORK'),
f5 which is identical will compile. Clearly something in the type
matching code is failing to expand user defined type conversions for
references to template types. I know nothing of the internals of GCC
so I thought I would submit the bug in the hope that someone with more
clue would be able to help.
---------------------
template <class T>
struct X {
operator bool() const;
};
struct Y {
operator bool() const;
};
void f1(const Y x) { if (x) return; }
void f2(const Y &x) { if (x) return; }
#ifndef WORK
void f3(const X<Y> &x) { if (x) return; } // fails if precedes 'f4'
#endif WORK
void f4(const X<Y> x) { if (x) return; }
void f5(const X<Y> &x) { if (x) return; }