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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to