MSVC doesn't do any validation regarding exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Francois Pichet 2011-05-24 02:11:43 +00:00
Родитель 1ebb6f29ed
Коммит 0f161593b3
3 изменённых файлов: 18 добавлений и 1 удалений

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

@ -582,6 +582,9 @@ def warn_mismatched_exception_spec : ExtWarn<
def err_override_exception_spec : Error<
"exception specification of overriding function is more lax than "
"base version">;
def warn_override_exception_spec : ExtWarn<
"exception specification of overriding function is more lax than "
"base version">, InGroup<Microsoft>;
def err_incompatible_exception_specs : Error<
"target exception specification is not superset of source">;
def err_deep_exception_specs_differ : Error<

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

@ -714,7 +714,10 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New,
return false;
}
}
return CheckExceptionSpecSubset(PDiag(diag::err_override_exception_spec),
unsigned DiagID = diag::err_override_exception_spec;
if (getLangOptions().Microsoft)
DiagID = diag::warn_override_exception_spec;
return CheckExceptionSpecSubset(PDiag(DiagID),
PDiag(diag::note_overridden_virtual_function),
Old->getType()->getAs<FunctionProtoType>(),
Old->getLocation(),

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

@ -6,6 +6,8 @@ void f(const type_info &a);
// Microsoft doesn't validate exception specification.
namespace microsoft_exception_spec {
void foo(); // expected-note {{previous declaration}}
void foo() throw(); // expected-warning {{exception specification in declaration does not match previous declaration}}
@ -22,6 +24,15 @@ struct Derived : Base {
virtual void f3();
};
class A {
virtual ~A() throw(); // expected-note {{overridden virtual function is here}}
};
class B : public A {
virtual ~B(); // expected-warning {{exception specification of overriding function is more lax than base version}}
};
}
// MSVC allows type definition in anonymous union and struct
struct A