[LLVMbugs] [Bug 19504] New: awful diagnostics if a typedef name appears on the LHS of a ::
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 21 17:28:48 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19504
Bug ID: 19504
Summary: awful diagnostics if a typedef name appears on the LHS
of a ::
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140422/5045427e/attachment.html>
More information about the llvm-bugs
mailing list