Change the wording of RTTI errors to make them more generic.

An attempt to use dynamic_cast while rtti is disabled, used to emit the error:

  cannot use dynamic_cast with -fno-rtti

and a similar one for typeid.

This patch changes that to:

  use of dynamic_cast requires -frtti

Differential Revision: https://reviews.llvm.org/D47291

llvm-svn: 334153
This commit is contained in:
Sunil Srivastava 2018-06-07 00:42:59 +00:00
parent 661d81ef61
commit a74031b640
2 changed files with 4 additions and 4 deletions
clang
include/clang/Basic
test/SemaCXX

@ -6607,9 +6607,9 @@ def err_not_tag_in_scope : Error<
"no %select{struct|interface|union|class|enum}0 named %1 in %2">;
def err_no_typeid_with_fno_rtti : Error<
"cannot use typeid with -fno-rtti">;
"use of typeid requires -frtti">;
def err_no_dynamic_cast_with_fno_rtti : Error<
"cannot use dynamic_cast with -fno-rtti">;
"use of dynamic_cast requires -frtti">;
def err_cannot_form_pointer_to_member_of_reference_type : Error<
"cannot form a pointer-to-member to member %0 of reference type %1">;

@ -6,7 +6,7 @@ namespace std {
void f()
{
(void)typeid(int); // expected-error {{cannot use typeid with -fno-rtti}}
(void)typeid(int); // expected-error {{use of typeid requires -frtti}}
}
namespace {
@ -20,7 +20,7 @@ struct B : public A {
}
bool isa_B(A *a) {
return dynamic_cast<B *>(a) != 0; // expected-error {{cannot use dynamic_cast with -fno-rtti}}
return dynamic_cast<B *>(a) != 0; // expected-error {{use of dynamic_cast requires -frtti}}
}
void* getMostDerived(A* a) {