diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-03-08 23:00:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-03-08 23:00:26 +0000 |
commit | a54d32404c0942321bb9d8c0f184ae15f7dc688b (patch) | |
tree | 8f53b73b0dfafc88ea91ac7a61cce29d49ecd1ae /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | 05048633834be2be634b3e32751a08b2eef12692 (diff) | |
download | bcm5719-llvm-a54d32404c0942321bb9d8c0f184ae15f7dc688b.tar.gz bcm5719-llvm-a54d32404c0942321bb9d8c0f184ae15f7dc688b.zip |
Take into account C++17's noexcept function types during merging -- it should
be possible to merge a declaration with an unresolved function type against one
with a resolved function type.
llvm-svn: 297316
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 719b6ad3414..d33a4759278 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2758,9 +2758,23 @@ static bool isSameEntity(NamedDecl *X, NamedDecl *Y) { CtorY->getInheritedConstructor().getConstructor())) return false; } + ASTContext &C = FuncX->getASTContext(); + if (!C.hasSameType(FuncX->getType(), FuncY->getType())) { + // We can get functions with different types on the redecl chain in C++17 + // if they have differing exception specifications and at least one of + // the excpetion specs is unresolved. + // FIXME: Do we need to check for C++14 deduced return types here too? + auto *XFPT = FuncX->getType()->getAs<FunctionProtoType>(); + auto *YFPT = FuncY->getType()->getAs<FunctionProtoType>(); + if (C.getLangOpts().CPlusPlus1z && XFPT && YFPT && + (isUnresolvedExceptionSpec(XFPT->getExceptionSpecType()) || + isUnresolvedExceptionSpec(YFPT->getExceptionSpecType())) && + C.hasSameFunctionTypeIgnoringExceptionSpec(FuncX->getType(), + FuncY->getType())) + return true; + return false; + } return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() && - FuncX->getASTContext().hasSameType(FuncX->getType(), - FuncY->getType()) && hasSameOverloadableAttrs(FuncX, FuncY); } |