Disable exception-spec compatibility checking under -fno-exceptions.

Fixes PR7243.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104942 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2010-05-28 08:37:35 +00:00
Родитель 1d0a5856d0
Коммит 811d0bec4d
2 изменённых файлов: 41 добавлений и 0 удалений

Просмотреть файл

@ -249,6 +249,10 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID,
SourceLocation NewLoc,
bool *MissingExceptionSpecification,
bool *MissingEmptyExceptionSpecification) {
// Just completely ignore this under -fno-exceptions.
if (!getLangOptions().Exceptions)
return false;
if (MissingExceptionSpecification)
*MissingExceptionSpecification = false;
@ -318,6 +322,11 @@ bool Sema::CheckExceptionSpecSubset(
const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
const FunctionProtoType *Superset, SourceLocation SuperLoc,
const FunctionProtoType *Subset, SourceLocation SubLoc) {
// Just auto-succeed under -fno-exceptions.
if (!getLangOptions().Exceptions)
return false;
// FIXME: As usual, we could be more specific in our error messages, but
// that better waits until we've got types with source locations.

Просмотреть файл

@ -0,0 +1,32 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// Note: this is intentionally -fno-exceptions, not just accidentally
// so because that's the current -cc1 default.
// PR7243: redeclarations
namespace test0 {
void foo() throw(int);
void foo() throw();
}
// Overrides.
namespace test1 {
struct A {
virtual void foo() throw();
};
struct B : A {
virtual void foo() throw(int);
};
}
// Calls from less permissive contexts. We don't actually do this
// check, but if we did it should also be disabled under
// -fno-exceptions.
namespace test2 {
void foo() throw(int);
void bar() throw() {
foo();
}
}