================
@@ -14,3 +19,234 @@ template <typename T>
constexpr T foo(T a) {
return a;
}
+
+namespace GH73232 {
+namespace ex1 {
+template <typename T>
+constexpr void g(T);
+
+constexpr int f() {
+ g(0);
+ return 0;
+}
+
+template <typename T>
+constexpr void g(T) {}
+
+constexpr auto z = f();
+}
+
+namespace ex2 {
+template <typename> constexpr static void fromType();
+
+void registerConverter() { fromType<int>(); }
+template <typename> struct QMetaTypeId {};
+template <typename T> constexpr void fromType() {
+ (void)QMetaTypeId<T>{};
+}
+template <> struct QMetaTypeId<int> {};
+} // namespace ex2
+
+namespace ex3 {
+
+#if __cplusplus > 202302L
+struct A {
+ consteval A(int i) {
+ chk(i);
+ }
+ constexpr void chk(auto) {}
+};
+A a{1};
+
+#endif
+
+}
+
+} // namespace GH73232
+
+
+namespace GH156255 {
+
+class X
+{
+public:
+ constexpr int f( int x ) const
+ {
+ return g( x );
+ }
+
+private:
+
+ template<class T>
+ constexpr T g( T x ) const
+ {
+ return x;
+ }
+};
+
+// check that g is instantiated here.
+constexpr int x = X().f( 1 );
+}
+
+#if __cplusplus > 202002L
+
+namespace instantiation_context_lookup {
+
+static constexpr int i = 42;
+static constexpr int v = 8;
+
+
+constexpr int f(auto);
+
+constexpr int g(int v = 42) {
+ static constexpr int i = 1;
+ return f(1);
+ return 0;
+}
+
+constexpr int f(auto) {
+ return i + v;
+}
+
+static_assert(g() == 50);
+
+}
+
+namespace GH35052 {
+
+template <typename F>
+constexpr int func(F f) {
+ if constexpr (f(1UL)) {
+ return 1;
+ }
+ return 0;
+}
+
+int test() {
+ auto predicate = [](auto v) constexpr -> bool { return v == 1; };
+ return func(predicate); // check that "predicate" is instantiated.
+}
+
+
+} // namespace GH35052
+
+namespace GH115118 {
+
+// Currently fails an assertion due to GH199347.
+/*struct foo {
+ foo(const foo&) = default;
+ foo(auto)
+ requires([]<int = 0>() -> bool { return true; }())
+ {}
+};
+
+struct bar {
+ foo x; // check that the lambda gets instantiated.
+};*/
+
+} // namespace GH115118
----------------
katzdm wrote:
All good now. 👍
https://github.com/llvm/llvm-project/pull/205557
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits