From e29c5cd2398c6c7a1b21b4ed631f21a2aaed4427 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 10 Dec 2009 19:51:03 +0000 Subject: Improve the diagnostic when a new declaration conflicts with a using shadow declaration. Rename note_using_decl to note_using, which is possibly less confusing. Add a test for non-class-scope using decl collisions and be sure to note the case we can't diagnose yet. llvm-svn: 91057 --- clang/lib/Sema/SemaDecl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a171217073e..6574ad2e87d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -803,6 +803,15 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { else Old = dyn_cast(OldD); if (!Old) { + if (UsingShadowDecl *Shadow = dyn_cast(OldD)) { + Diag(New->getLocation(), diag::err_using_decl_conflict_reverse); + Diag(Shadow->getTargetDecl()->getLocation(), + diag::note_using_decl_target); + Diag(Shadow->getUsingDecl()->getLocation(), + diag::note_using_decl) << 0; + return true; + } + Diag(New->getLocation(), diag::err_redefinition_different_kind) << New->getDeclName(); Diag(OldD->getLocation(), diag::note_previous_definition); -- cgit v1.2.3