1

I am using clang 13 to analyze this code:

int f1(){
int a=5;
short b=4;
bool a1=a;//maybe warn
bool b1=b;//maybe warn
if(a1&&b1)return 1;
return 0;
}
class M{
public:
    virtual int GetAge(){return 0;}
};
class P:public M{
public:
    virtual int GetAge(){return 1;}
    P(){GetAge();}//maybe warn
    ~P(){GetAge();}//maybe warn
};

int main(){
    return 0;
}

but when I run scan-build -enable-checker alpha.core.BoolAssignment clang++ a5.cpp it gives:

scan-build: Using '/usr/lib/llvm-13/bin/clang' for static analysis
scan-build: Analysis run complete.
scan-build: Removing directory '/tmp/scan-build-2021-10-15-191934-7950-1' because it contains no reports.
scan-build: No bugs found.

However I had expected errors from scan-build. What am I doing wrong?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.