<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - awful diagnostics if a typedef name appears on the LHS of a ::"
href="http://llvm.org/bugs/show_bug.cgi?id=19504">19504</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>awful diagnostics if a typedef name appears on the LHS of a ::
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>typedef struct S {
void func();
} T;
typedef int U;
T foo();
U bar();
struct X {
friend U ::bar();
friend T ::foo();
friend T ::func();
};
No-one diagnoses this well, but EDG does a bit better than we do here. Clang
says:
<stdin>:8:10: error: 'U' (aka 'int') is not a class, namespace, or scoped
enumeration
friend U ::bar();
^
<stdin>:9:14: error: C++ requires a type specifier for all declarations
friend T ::foo();
~~~~~~ ^
<stdin>:9:14: error: no function named 'foo' with type 'int ()' was found in
the specified scope
<stdin>:10:14: error: C++ requires a type specifier for all declarations
friend T ::func();
~~~~~~ ^
4 errors generated.
We should be able to do *vastly* better. Ideal would be something like:
<stdin>:8:10: error: identifier before '::' is not a class, namespace, or
scoped enumeration; add parentheses to treat 'U' as the return type
friend U ::bar();
^
( )
<stdin>:9:14: error: no function named 'foo' was found in 'T' (aka 'S'); add
parentheses to treat 'T' as the return type
friend T ::foo();
~~~~~~ ^
( )
<stdin>:10:14: error: missing return type 'void' in friend declaration
friend T ::func();
~~~~~~ ^
void</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>