diff clang/test/SemaCXX/builtins.cpp @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children c4bab56944e8
line wrap: on
line diff
--- a/clang/test/SemaCXX/builtins.cpp	Tue Jun 15 19:13:43 2021 +0900
+++ b/clang/test/SemaCXX/builtins.cpp	Tue Jun 15 19:15:29 2021 +0900
@@ -113,7 +113,7 @@
 static_assert(const_ptr != test_constexpr_launder(&const_int2), "");
 
 void test_non_constexpr() {
-  constexpr int i = 42;                            // expected-note {{declared here}}
+  constexpr int i = 42;                            // expected-note {{address of non-static constexpr variable 'i' may differ on each invocation}}
   constexpr const int *ip = __builtin_launder(&i); // expected-error {{constexpr variable 'ip' must be initialized by a constant expression}}
   // expected-note@-1 {{pointer to 'i' is not a constant expression}}
 }
@@ -144,3 +144,12 @@
 }
 #undef TEST_TYPE
 } // end namespace test_launder
+
+template<typename T> void test_builtin_complex(T v, double d) {
+  (void)__builtin_complex(v, d); // expected-error {{different types}} expected-error {{not a real floating}}
+  (void)__builtin_complex(d, v); // expected-error {{different types}} expected-error {{not a real floating}}
+  (void)__builtin_complex(v, v); // expected-error {{not a real floating}}
+}
+template void test_builtin_complex(double, double);
+template void test_builtin_complex(float, double); // expected-note {{instantiation of}}
+template void test_builtin_complex(int, double); // expected-note {{instantiation of}}