xref: /llvm-project/clang/test/CodeGen/builtin-redeclaration.c (revision e09107ab80dced55414fa458cf78e6cdfe90da6e)
1 // RUN: %clang_cc1 -emit-llvm-only %s
2 
3 // PR45410
4 // Ensure we mark local extern redeclarations with a different type as non-builtin.
non_builtin()5 void non_builtin() {
6   extern float exp();
7   exp(); // Will crash due to wrong number of arguments if this calls the builtin.
8 }
9 
10 // PR45410
11 // We mark exp() builtin as const with -fno-math-errno (default).
12 // We mustn't do that for extern redeclarations of builtins where the type differs.
attribute()13 float attribute() {
14   extern float exp();
15   return exp(1);
16 }
17