c++.beta - [bug] DMC 8.49 enum lookup through class derived from template parameter
- Sean Kelly <sean f4.ca> Oct 23 2006
- Christof Meerwald <cmeerw web.de> Oct 23 2006
- Sean Kelly <sean f4.ca> Oct 23 2006
I believe this lookup should succeed as it does when C explicitly
derives from B.
C:\code\src\gen\test>type test.cpp
class B
{
protected:
enum
{
ZERO = 0
};
};
template<class T>
class C : T
{
public:
C() : val( ZERO ) {}
private:
int val;
};
void main()
{
C<B> d;
}
C:\code\src\gen\test>dmc test.cpp
test.cpp(15) : Error: undefined identifier 'ZERO'
test.cpp(26) : Error: expression expected
Fatal error: premature end of source file
--- errorlevel 1
C:\code\src\gen\test>
Oct 23 2006
On Mon, 23 Oct 2006 09:59:32 -0700, Sean Kelly wrote:I believe this lookup should succeed as it does when C explicitly derives from B.
No, this is a feature (two-phase name lookup) - you can disable this feature with -Ad though. Christof -- http://cmeerw.org sip:cmeerw at cmeerw.org mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
Oct 23 2006
Christof Meerwald wrote:On Mon, 23 Oct 2006 09:59:32 -0700, Sean Kelly wrote:I believe this lookup should succeed as it does when C explicitly derives from B.
No, this is a feature (two-phase name lookup) - you can disable this feature with -Ad though.
Oops... my actual code was a tad different than what I posted: template<class T> class B {...}; template<class T> class C : B<T> { ... }; But the dependent name lookup rules still obviously apply. Next time I'll spend more time with the spec rather than testing against other compilers... or at least test against Comeau. Thanks! Sean
Oct 23 2006








Sean Kelly <sean f4.ca>