<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Improve diagnostics for trying to invoke a destructor on a qualified namespace"
href="https://bugs.llvm.org/show_bug.cgi?id=43494">43494</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Improve diagnostics for trying to invoke a destructor on a qualified namespace
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arcata@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>If you try to invoke the destructor on a `std::string`, and you don't already
know the answer for what you're supposed to write, then the diagnostics are not
helpful at best, and misleading at worst:
% cat ~/foo.cpp
#include <string>
void destroyString(std::string &&s) {
s.~string();
}
% xcrun clang++ ~/foo.cpp
/Users/jgroff/foo.cpp:3:6: error: identifier 'string' in object destruction
expression does not name
a type
s.~string();
^
% cat ~/foo1.cpp
#include <string>
void destroyString(std::string &&s) {
s.~std::string();
}
% clang++ ~/foo1.cpp
/Users/jgroff/foo1.cpp:3:5: error: '~' in destructor name should be after
nested name specifier
s.~std::string();
^
~
/Users/jgroff/foo.cpp:3:5: error: qualified member access refers to a member in
namespace 'std'
s.~std::string();
^~~~~~
% cat ~/foo2.cpp
#include <string>
void destroyString(std::string &&s) {
s.std::~string();
}
% clang++ ~/foo2.cpp
/Users/jgroff/foo2.cpp:3:10: error: qualified member access refers to a member
in namespace 'std'
s.std::~string();
~~~~~^
% cat ~/foo3.cpp
#include <string>
void destroyString(std::string &&s) {
s.std::string::~string();
}
% clang++ ~/foo3.cpp
/Users/jgroff/foo3.cpp:3:19: error: expected the class name after '~' to name a
destructor
s.std::string::~string();
^
Any of these diagnostics seem like they could offer a fixit directly to the
correct syntax for what the user is trying to write, `s.~basic_string()`.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>