[cfe-users] compiler bug or language feature?

Daniel Schwalbe dansch491 at gmail.com
Tue Oct 8 10:05:07 PDT 2013


When I add the 'template' keyword as suggested clang gives me the very 
same error. g++ still eats it without problem.

Am 08.10.2013 18:23, schrieb David Blaikie:
>
>
>
> On Tue, Oct 8, 2013 at 8:36 AM, Daniel Schwalbe <dansch491 at gmail.com 
> <mailto:dansch491 at gmail.com>> wrote:
>
>     Hi,
>
>     I don't know if I encountered a compiler bug in clang 3.3 or if
>     this is one of the many subtle c++ exceptional cases:
>
>     When I try to compile the attached file (using: clang++ -std=c++11
>     test.cpp) I receive a compiler error:
>
>     "test.cpp:15:42: error: identifier 'SmartPtrType' in object
>     destruction expression does not name a type
>      ~SmartUnion() {m_sptr.SmartPtrType<T>::~SmartPtrType(); }"
>
>     g++ compiles the file without problem.
>
>     clang compiles it, too, if I explicitly introduce a typedef for
>     SmartPtrType<T> and call this typedef name instead:
>
>     typedef SmartPtrType<T> smartptr_type;
>     ~SmartUnion() {m_sptr.smartptr_type::~smartptr_type(); }
>
>     Is this a subtle language feature or a compiler bug?
>
>
> I believe this is a language feature because the expression is 
> ambiguous if m_sptr is type dependent (which I assume it is)
>
> The other solution, rather than introducing a typedef, is to use the 
> 'template' keyword:
>
> ~SmartUnion() {m_sptr.template SmartPtrType<T>::~SmartPtrType(); }
>
>
>
>     Daniel
>
>
>
>
>     _______________________________________________
>     cfe-users mailing list
>     cfe-users at cs.uiuc.edu <mailto:cfe-users at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131008/b2e5663d/attachment.html>


More information about the cfe-users mailing list