[cfe-users] compiler bug or language feature?

David Blaikie dblaikie at gmail.com
Tue Oct 8 09:23:28 PDT 2013


On Tue, Oct 8, 2013 at 8:36 AM, Daniel Schwalbe <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
> 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/1ffa8e9e/attachment.html>


More information about the cfe-users mailing list