Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313817

Summary: False "Statement has no effect" warnings on assignment of class instances.
Product: [Tools] CDT Reporter: Vadym Krevs <vkrevs>
Component: cdt-codanAssignee: Elena Laskavaia <elaskavaia.cdt>
Status: RESOLVED FIXED QA Contact: Elena Laskavaia <elaskavaia.cdt>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 7.0   
Target Milestone: 7.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Vadym Krevs CLA 2010-05-20 17:19:05 EDT
Build Identifier: I20100518-0800

Create a new CPP file containing
#include <string>
std::string gettempdir()
{
    return "Hello";
}
void foo()
{
    std::string jailDir;
    jailDir = gettempdir();

    chdir(jailDir);
}

Problem analysis highlights "jaildir=gettempdir()" and adds  a "Statement has no effect" warning to the problems list.

Assignment of primitive types does not seem to be affected.

Reproducible: Always
Comment 2 Elena Laskavaia CLA 2010-05-22 22:29:19 EDT
fixed
Comment 3 CDT Genie CLA 2010-07-28 15:29:12 EDT
*** cdt cvs genie on behalf of elaskavaia ***
Bug 313817 Fixed f.p. when assignment is overloaded operator

[*] StatementHasNoEffectChecker.java 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java?root=Tools_Project&r1=1.11&r2=1.12