We weren't writing out the definition of an inline variable, so the importer
either got an undefined symbol or 0.
gcc/cp/ChangeLog:
* module.cc (has_definition): Also true for inline vars.
gcc/testsuite/ChangeLog:
* g++.dg/modules/inline-1_a.C: New test.
* g++.dg/modules/inline-1_b.C: New test.
since there's no TU to emit them in otherwise. */
return true;
- if (!decl_maybe_constant_var_p (decl))
+ if (!decl_maybe_constant_var_p (decl)
+ && !DECL_INLINE_VAR_P (decl))
return false;
return true;
--- /dev/null
+// { dg-additional-options -fmodules }
+// { dg-module-do run }
+export module M;
+
+inline int b = 42;
+struct A
+{
+ static inline int a = 4200;
+};
+
+export inline int f() { return b+A::a; }
--- /dev/null
+// { dg-additional-options -fmodules }
+import M;
+
+int main()
+{
+ if (f() != 4242)
+ __builtin_abort ();
+}