forked from OSchip/llvm-project
Preserve exception specs in function decl merging.
Exception specs are not part of the canonical type, but we shouldn't drop them just because we merged a noreturn attribute. Fixes PR17110. llvm-svn: 190206
This commit is contained in:
parent
deeafd8a58
commit
e934af8e58
|
@ -2382,9 +2382,11 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RequiresAdjustment) {
|
if (RequiresAdjustment) {
|
||||||
NewType = Context.adjustFunctionType(NewType, NewTypeInfo);
|
const FunctionType *AdjustedType = New->getType()->getAs<FunctionType>();
|
||||||
New->setType(QualType(NewType, 0));
|
AdjustedType = Context.adjustFunctionType(AdjustedType, NewTypeInfo);
|
||||||
|
New->setType(QualType(AdjustedType, 0));
|
||||||
NewQType = Context.getCanonicalType(New->getType());
|
NewQType = Context.getCanonicalType(New->getType());
|
||||||
|
NewType = cast<FunctionType>(NewQType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this redeclaration makes the function inline, we may need to add it to
|
// If this redeclaration makes the function inline, we may need to add it to
|
||||||
|
|
|
@ -34,3 +34,8 @@ template<typename T> struct U {
|
||||||
|
|
||||||
template<typename T> U<T>::~U() noexcept(true) {} // expected-error {{exception specification in declaration does not match previous declaration}}
|
template<typename T> U<T>::~U() noexcept(true) {} // expected-error {{exception specification in declaration does not match previous declaration}}
|
||||||
template<typename T> void U<T>::operator delete(void*) noexcept(false) {} // expected-error {{exception specification in declaration does not match previous declaration}}
|
template<typename T> void U<T>::operator delete(void*) noexcept(false) {} // expected-error {{exception specification in declaration does not match previous declaration}}
|
||||||
|
|
||||||
|
|
||||||
|
// Make sure this restriction interacts properly with __attribute__((noreturn))
|
||||||
|
void __attribute__ ((__noreturn__)) PR17110(int status) throw();
|
||||||
|
void PR17110(int status) throw();
|
||||||
|
|
Loading…
Reference in New Issue