| Summary: | "possible assignment in condition" invalid for correct assignment | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Martin Nowack <martin> |
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, chfast, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
I get no errors or warnings with CDT 8.2 (Kepler). CDT (8.6 and before) has problems with llvm::dyn_cast template. dyn_cast is reported as unresolved symbol. (In reply to Missing name from comment #2) > CDT (8.6 and before) has problems with llvm::dyn_cast template. dyn_cast is > reported as unresolved symbol. That sounds like a different issue - this bug is about a false-positive "possible assignment in condition" warning. Could you file a new bug for the issue you're having, preferably with a complete testcase? |
Build Identifier: 20110916-0149 testcase: if (llvm::Value * c = dyn_cast<llvm::Value>(val)) { } The analyzer marks "c" as unresolved symbol and therefore assumes that there might be an invalid assignment in the condition. Workaround: If the assignment is moved outside the if clause, it works as expected. llvm::Value * c = dyn_cast<llvm::Value>(val) if (c) { Reproducible: Always