<div dir="ltr">You need to write<div><br></div><div> m_sptr.SmartPtrType<T>::~SmartPtrType<b><T></b>();<br><div class="gmail_extra"><br></div><div class="gmail_extra">Per 3.4.3/6, "in a qualified-id of the form nested-name-specifier[opt] class-name::~class-name, the second class-name is looked up in the same scope as the first". So you can't use the injected-class-name after the ~, because it's not visible.</div>
<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 8, 2013 at 10:05 AM, Daniel Schwalbe <span dir="ltr"><<a href="mailto:dansch491@gmail.com" target="_blank">dansch491@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>When I add the 'template' keyword as
suggested clang gives me the very same error. g++ still eats it
without problem.<br>
<br>
Am 08.10.2013 18:23, schrieb David Blaikie:<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Oct 8, 2013 at 8:36 AM,
Daniel Schwalbe <span dir="ltr"><<a href="mailto:dansch491@gmail.com" target="_blank">dansch491@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
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:<br>
<br>
When I try to compile the attached file (using: clang++
-std=c++11 test.cpp) I receive a compiler error:<br>
<br>
"test.cpp:15:42: error: identifier 'SmartPtrType' in
object destruction expression does not name a type<br>
~SmartUnion() {m_sptr.SmartPtrType<T>::~SmartPtrType();
}"<br>
<br>
g++ compiles the file without problem.<br>
<br>
clang compiles it, too, if I explicitly introduce a
typedef for SmartPtrType<T> and call this typedef
name instead:<br>
<br>
typedef SmartPtrType<T> smartptr_type;<br>
~SmartUnion() {m_sptr.smartptr_type::~smartptr_type(); }<br>
<br>
Is this a subtle language feature or a compiler bug?</blockquote>
<div><br>
</div>
<div>I believe this is a language feature because the
expression is ambiguous if m_sptr is type dependent (which
I assume it is)<br>
<br>
The other solution, rather than introducing a typedef, is
to use the 'template' keyword:<br>
<br>
~SmartUnion() {m_sptr.template SmartPtrType<T>::~SmartPtrType();
}<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font color="#888888"><br>
<br>
Daniel<br>
<br>
<br>
<br>
</font></span><br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@cs.uiuc.edu" target="_blank">cfe-users@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br></div></div></div>