Clang error: assignment to cast is illegal, lvalue casts are not supported (err_typecheck_lvalue_casts_not_supported)
Jump to navigation
Jump to search
Text | error: assignment to cast is illegal, lvalue casts are not supported |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_typecheck_lvalue_casts_not_supported |
Internal Message | assignment to cast is illegal, lvalue casts are not supported
|
Regular Expression | (?:error|fatal error)\: assignment to cast is illegal, lvalue casts are not supported
|
First Commit | 2009-03-14 5a8987ca5113 Update tablegen diagnostic files to be in sync with the def files. |
Description
Example
Flags | -xc
|
|
---|---|---|
Source |
int main() {
int *a;
// Cast dereferenced pointer to int before assignment
(int)*a = 1;
}
| |
Compiler Output |
<source>:5:3: error: assignment to cast is illegal, lvalue casts are not supported |
Clang Internals (17.0.6)
Git Commit Message
Update tablegen diagnostic files to be in sync with the def files. llvm-svn: 67004
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/SemaExpr.cpp (line 14357)
/// CheckForModifiableLvalue - Verify that E is a modifiable lvalue. If not,
/// emit an error and return true. If so, return false.
static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
// ...
case Expr::MLV_LValueCast:
DiagID = diag::err_typecheck_lvalue_casts_not_supported;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Sema/block-misc.c
- clang/test/Sema/block-misc.c:33:3: error: assignment to cast is illegal, lvalue casts are not supported