Clang error: unexpected interface name A: expected expression (err_unexpected_interface)
Jump to navigation
Jump to search
Text | error: unexpected interface name A: expected expression |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_unexpected_interface |
Internal Message | unexpected interface name %0: expected expression
|
Regular Expression | (?:error|fatal error)\: unexpected interface name (.*?)\: expected expression
|
First Commit | 2009-03-14 5a8987ca5113 Update tablegen diagnostic files to be in sync with the def files. |
Description
Example
Flags | -xobjective-c
|
|
---|---|---|
Source |
// Interface definition without a base class
@interface C
// Method flagged as directly callable but not supported
+ (void)f __attribute__((objc_direct));
@end
@implementation C
+ (void)f {}
@end
int main() {
// Trying to call 'f' on 'C' directly, but 'C' is used as a type instead of an object
[(id)C f];
return 0;
}
| |
Compiler Output |
<source>:5:26: warning: 'objc_direct' attribute isn't implemented by this Objective-C runtime [-Wignored-attributes] <source>:2:12: warning: class 'C' defined without specifying a base class [-Wobjc-root-class] <source>:2:13: note: add a super class to fix this problem <source>:14:8: error: unexpected interface name 'C': expected expression |
Clang Internals (17.0.6)
Git Commit Message
Update tablegen diagnostic files to be in sync with the def files. llvm-svn: 67004
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaExpr.cpp (line 3300)
/// Diagnoses obvious problems with the use of the given declaration
/// as an expression. This is only actually called for lookups that
/// were not overloaded, and it doesn't promise that the declaration
/// will in fact be used.
static bool CheckDeclInExpr(Sema &S, SourceLocation Loc, NamedDecl *D, bool AcceptInvalid) {
// ...
if (isa<ObjCInterfaceDecl>(D)) {
S.Diag(Loc, diag::err_unexpected_interface) << D->getDeclName();
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/SemaObjC/crash-on-type-args-protocols.m
- clang/test/SemaObjC/crash-on-type-args-protocols.m:23:15: error: unexpected interface name 'X': expected expression