diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-11-03 23:51:28 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-11-03 23:51:28 +0000 |
commit | 42350dfcc82c0f9a67feaacaa6581fdd54841416 (patch) | |
tree | f05dabdbd9189d96f1666b7a97c9697f8969b06c /clang/lib/AST/ItaniumMangle.cpp | |
parent | 99c096472d789c7f60c81f99b28b3071565c9508 (diff) | |
download | bcm5719-llvm-42350dfcc82c0f9a67feaacaa6581fdd54841416.tar.gz bcm5719-llvm-42350dfcc82c0f9a67feaacaa6581fdd54841416.zip |
Sema: Do not allow overloading between methods based on restrict
If the sole distinction between two declarations is that one has a
__restrict qualifier then we should not consider it to be an overload.
Instead, we will consider it as an incompatible redeclaration which is
similar to how MSVC, ICC and GCC would handle it.
This fixes PR17786.
N.B. We must not mangle in __restrict into method qualifiers becase we
don't allow overloading between such declarations anymore. To do
otherwise would be a violation of the Itanium ABI.
llvm-svn: 193964
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 21a6c107bb7..953bff20ad6 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -1239,7 +1239,12 @@ void CXXNameMangler::mangleNestedName(const NamedDecl *ND, Out << 'N'; if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(ND)) { - mangleQualifiers(Qualifiers::fromCVRMask(Method->getTypeQualifiers())); + Qualifiers MethodQuals = + Qualifiers::fromCVRMask(Method->getTypeQualifiers()); + // We do not consider restrict a distinguishing attribute for overloading + // purposes so we must not mangle it. + MethodQuals.removeRestrict(); + mangleQualifiers(MethodQuals); mangleRefQualifier(Method->getRefQualifier()); } |