forked from OSchip/llvm-project
Error when using typeid() with -fno-rtti. PR 12888.
llvm-svn: 157139
This commit is contained in:
parent
022900079b
commit
1b7f39de3d
|
@ -4392,6 +4392,9 @@ def err_invalid_declarator_in_function : Error<
|
|||
def err_not_tag_in_scope : Error<
|
||||
"no %select{struct|union|class|enum}0 named %1 in %2">;
|
||||
|
||||
def err_no_typeid_with_fno_rtti : Error<
|
||||
"cannot use typeid with -fno-rtti">;
|
||||
|
||||
def err_cannot_form_pointer_to_member_of_reference_type : Error<
|
||||
"cannot form a pointer-to-member to member %0 of reference type %1">;
|
||||
def err_incomplete_object_call : Error<
|
||||
|
|
|
@ -379,6 +379,10 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
|
|||
return ExprError(Diag(OpLoc, diag::err_need_header_before_typeid));
|
||||
}
|
||||
|
||||
if (!getLangOpts().RTTI) {
|
||||
return ExprError(Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
|
||||
}
|
||||
|
||||
QualType TypeInfoType = Context.getTypeDeclType(CXXTypeInfoDecl);
|
||||
|
||||
if (isType) {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -fno-rtti %s
|
||||
|
||||
namespace std {
|
||||
class type_info;
|
||||
}
|
||||
|
||||
void f()
|
||||
{
|
||||
(void)typeid(int); // expected-error {{cannot use typeid with -fno-rtti}}
|
||||
}
|
Loading…
Reference in New Issue