In the following test case, the two "baz" functions are ill-formed. Since the expression being returned is non-dependent, the improper return value should be detected when the template is initially parsed.
template <class T> struct Foo { int i; }; struct Baz { int* j; }; template <class T> struct Bar : public Foo<T>, Baz { using Baz::j; char* baz () { return j; } // { dg-error "cannot convert" } }; template <class T> struct Bar2 : Baz { using Baz::j; char* baz () { return j; } // { dg-error "cannot convert" } }; -- Summary: Inadequate type-checking for non-dependent expressions in return statements Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: doug dot gregor at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27167