[PATCH] D103485: Fix a diagnoses-valid bug with using declarations
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 1 12:49:07 PDT 2021
aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, rjmccall, erichkeane.
aaron.ballman requested review of this revision.
Herald added a project: clang.
The following was found by a customer and is accepted by the other primary C++ compilers, but fails to compile in Clang:
namespace sss {
double foo(int, double);
template <class T>
T foo(T); // note: target of using declaration
} // namespace sss
namespace oad {
void foo();
}
namespace oad {
using ::sss::foo;
}
namespace sss {
using oad::foo; // note: using declaration
}
namespace sss {
double foo(int, double) { return 0; }
template <class T>
T foo(T t) { // error: declaration conflicts with target of using declaration already in scope
return t;
}
} // namespace sss
I believe the issue is that `MergeFunctionDecl()` was calling `checkUsingShadowRedecl()` but only considering a `FunctionDecl` as a possible shadow and not `FunctionTemplateDecl`. The changes in this patch largely mirror how variable declarations were being handled by also catching `FunctionTemplateDecl`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103485
Files:
clang/lib/Sema/SemaDecl.cpp
clang/test/CXX/modules-ts/basic/basic.def.odr/p6/global-vs-module.cpp
clang/test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-global.cpp
clang/test/CXX/modules-ts/basic/basic.def.odr/p6/module-vs-module.cpp
clang/test/SemaCXX/using-decl-templates.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103485.349065.patch
Type: text/x-patch
Size: 7694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210601/0e93179d/attachment.bin>
More information about the cfe-commits
mailing list