Thread overview | |||||
---|---|---|---|---|---|
|
October 23, 2006 [bug] DMC 8.49 enum lookup through class derived from template parameter | ||||
---|---|---|---|---|
| ||||
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> |
October 23, 2006 Re: [bug] DMC 8.49 enum lookup through class derived from template parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | 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 |
October 23, 2006 Re: [bug] DMC 8.49 enum lookup through class derived from template parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | 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
|
Copyright © 1999-2021 by the D Language Foundation