diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3911,6 +3911,7 @@ // ASTContext::typesAreCompatible(). if (Old->hasPrototype() && !New->hasWrittenPrototype() && NewDeclIsDefn && Old->getNumParams() != New->getNumParams()) { + Old = Old->getCanonicalDecl(); Diag(New->getLocation(), diag::err_conflicting_types) << New; Diag(Old->getLocation(), PrevDiag) << Old << Old->getType(); return true; diff --git a/clang/test/Sema/prototype-redecls.c b/clang/test/Sema/prototype-redecls.c --- a/clang/test/Sema/prototype-redecls.c +++ b/clang/test/Sema/prototype-redecls.c @@ -12,6 +12,10 @@ void blerp(short); // expected-note {{previous}} void blerp(x) int x; {} // expected-error {{conflicting types for 'blerp'}} +void foo(int); // expected-note {{previous}} +void foo(); +void foo() {} // expected-error {{conflicting types for 'foo'}} + void glerp(int); void glerp(x) short x; {} // Okay, promoted type is fine