Skip to content

Commit

Permalink
[Sema] Add test for __builtin_fminf errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
fhahn committed Sep 13, 2021
1 parent 9db7e8e commit d86a947
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions clang/test/Sema/overloaded-math-builtins.c
@@ -0,0 +1,21 @@
// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9

typedef float float4 __attribute__((ext_vector_type(4)));

float test_fminf(float f, int i, int *ptr, float4 v) {
float r1 = __builtin_fminf(f, ptr);
// expected-error@-1 {{passing 'int *' to parameter of incompatible type 'float'}}
float r2 = __builtin_fminf(ptr, f);
// expected-error@-1 {{passing 'int *' to parameter of incompatible type 'float'}}
float r3 = __builtin_fminf(v, f);
// expected-error@-1 {{passing 'float4' (vector of 4 'float' values) to parameter of incompatible type 'float'}}
float r4 = __builtin_fminf(f, v);
// expected-error@-1 {{passing 'float4' (vector of 4 'float' values) to parameter of incompatible type 'float'}}


int *r5 = __builtin_fminf(f, f);
// expected-error@-1 {{initializing 'int *' with an expression of incompatible type 'float'}}

int *r6 = __builtin_fminf(f, v);
// expected-error@-1 {{passing 'float4' (vector of 4 'float' values) to parameter of incompatible type 'float'}}
}

0 comments on commit d86a947

Please sign in to comment.