================
@@ -51,4 +39,71 @@ template<typename T> module module_var_template;
 
 // This is a variable named 'import' that shadows the type 'import' above.
 struct X {} import;
-#endif
+
+//--- ImportError1.cppm
+module;
+
+struct import { struct inner {}; };
+struct module { struct inner {}; };
+
+constexpr int n = 123;
+
+export module m; // #1
+
+import x = {}; // expected-error {{expected ';' after module name}}
+               // expected-error@-1 {{module 'x' not found}}
+
+//--- ImportError2.cppm
+module;
+
+struct module { struct inner {}; };
+
+constexpr int n = 123;
+
+export module m; // #1
+
+struct X;
+template<int> struct import;
+template<> struct import<n> {
+  static X y;
+};
+
+// This is not valid because the 'import <n>' is a pp-import, even though it
+// grammatically can't possibly be an import declaration.
+struct X {} import<n>::y; // expected-error {{'n' file not found}}
+
+//--- A.cppm
+export module A;
+const double delta=0.01;
+export {
+  template<class F>
+  double derivative(F &&f,double x) {
+    return (f(x+delta)-f(x))/delta;
+  }
+}
+
+//--- std.cppm
+export module std;
+export using size_t = decltype(sizeof(void *));
+
+export namespace std {
+  template <typename T, size_t N>
+  struct array {};
+}
+
+//--- A-B.cppm
+module A:B;
+const int dimensions=3;
+
+//--- A_impl.cppm
----------------
yronglin wrote:

Fixed

https://github.com/llvm/llvm-project/pull/147945
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to