<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56608>56608</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Wliteral-range: Clang treats double literal as float
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          felix-willgerodt
      </td>
    </tr>
</table>

<pre>
    Floating point literals without suffix are of type double.
I could find that statement in the ISO C 11 draft, not sure if I am allowed to link that.
But see also https://en.cppreference.com/w/cpp/language/floating_literal.

Yet, clang 15.0.0 doesn't seem to handle them as doubles.
Or maybe it is just a problem with the new Wliteral-range changes:
~~~
$ cat float.c
#define DELTA 0.001

int main() {
float a = 0.3;

if (a == DELTA)
  return 1;
else
  return 0;
}
$ clang float.c 
float.c:7:7: warning: floating-point comparison is always false; constant cannot be
represented exactly in type 'float' [-Wliteral-range]
if (a == DELTA)
    ~ ^  ~~~~~
1 warning generated.
~~~

When I make the define a double, there is no warning:

~~~
$ cat double.c 
double DELTA = 0.001;

int main() {
float a = 0.3;

if (a == DELTA)
  return 1;
else
  return 0;
}
$ clang double.c 
$
~~~

Did I miss anything? In my understanding, the warning shouldn't happen and it should be treated as a double.
Similar to the double.c case.

(The same behaviour can be seen with c++ and clang++)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVUGPmzoQ_jXkMgoyZhM2Bw6bzUZa6Uk9tFLVUzWBAdwag2zTbP79GxvSJqu2escnOWA89vibb76ZnIb6Uh71gF6ZFsZBGQ9aebKoHZyV74bJg5uaRr0BWoKhAX8ZCephOmlKE3FIxNMrVMOka2iUqcF3yCc8euqJnSnDKwSvHz_AM2QZ1BYbn8hnMENwzC5VA6-APaDWw5nYwcAIzPfoaLlgH0AQ8RY3QOf96JL8KZFHHmTSahwtNWTJVJRWQ8-rZ_7xMj81mnbClnj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