Author: Florian Hahn
Date: 2021-09-13T11:12:06+01:00
New Revision: d86a947bb91cc67452057b4bc25c0c7734b5139c

URL: 
https://github.com/llvm/llvm-project/commit/d86a947bb91cc67452057b4bc25c0c7734b5139c
DIFF: 
https://github.com/llvm/llvm-project/commit/d86a947bb91cc67452057b4bc25c0c7734b5139c.diff

LOG: [Sema] Add test for __builtin_fminf errors.

Added: 
    clang/test/Sema/overloaded-math-builtins.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/overloaded-math-builtins.c 
b/clang/test/Sema/overloaded-math-builtins.c
new file mode 100644
index 0000000000000..e18b98ab8d554
--- /dev/null
+++ b/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'}}
+}


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to