mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
25 lines
496 B
C#
25 lines
496 B
C#
using System;
|
|
|
|
namespace ConstantConditionalExpression
|
|
{
|
|
class Main
|
|
{
|
|
const int ZERO = 0;
|
|
|
|
public void Foo()
|
|
{
|
|
int i = (ZERO == 1 - 1) ? 0 : 1; // $ Alert
|
|
int j = false ? 0 : 1; // $ Alert
|
|
int k = " " == " " ? 0 : 1; // $ Alert
|
|
int l = (" "[0] == ' ') ? 0 : 1; // Missing Alert
|
|
int m = Bar() == 0 ? 0 : 1; // GOOD
|
|
}
|
|
|
|
public int Bar()
|
|
{
|
|
return ZERO;
|
|
}
|
|
|
|
}
|
|
}
|