Clang error: use of typeid requires -frtti (err_no_typeid_with_fno_rtti)
Jump to navigation
Jump to search
Text | error: use of typeid requires -frtti (since 7.0) error: cannot use typeid with -fno-rtti (until 6.0) |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_no_typeid_with_fno_rtti |
Internal Message | use of typeid requires -frtti (since 7.0)cannot use typeid with -fno-rtti (until 6.0)
|
Regular Expression | (?:error|fatal error)\: use of typeid requires \-frtti
|
First Commit | 2012-05-20 1b7f39de3d58 Error when using typeid() with -fno-rtti. PR 12888. |
Description
Example
Flags | -xc++ -fno-rtti
|
|
---|---|---|
Source |
#include <typeinfo>
int main() {
int a;
typeid(a); // Use of typeid without enabling RTTI
return 0;
}
| |
Compiler Output |
<source>:5:3: error: use of typeid requires -frtti |
Clang Internals (17.0.6)
Git Commit Message
Error when using typeid() with -fno-rtti. PR 12888. llvm-svn: 157139
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaExprCXX.cpp (line 678)
/// ActOnCXXTypeidOfType - Parse typeid( type-id ) or typeid (expression);
ExprResult Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc) {
// ...
if (!getLangOpts().RTTI) {
return ExprError(Diag(OpLoc, diag::err_no_typeid_with_fno_rtti));
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/SemaCXX/no-rtti.cpp
- clang/test/SemaCXX/no-rtti.cpp:9:9: error: use of typeid requires -frtti