break;
case CONSTRUCTOR:
- {
- unsigned len = vec_safe_length (t->constructor.elts);
- if (streaming_p ())
- WU (len);
- if (len)
- for (unsigned ix = 0; ix != len; ix++)
- {
- const constructor_elt &elt = (*t->constructor.elts)[ix];
-
- WT (elt.index);
- WT (elt.value);
- }
- }
+ // This must be streamed /after/ we've streamed the type,
+ // because it can directly refer to elements of the type. Eg,
+ // FIELD_DECLs of a RECORD_TYPE.
break;
case OMP_CLAUSE:
WU (prec);
}
+ if (TREE_CODE (t) == CONSTRUCTOR)
+ {
+ unsigned len = vec_safe_length (t->constructor.elts);
+ if (streaming_p ())
+ WU (len);
+ if (len)
+ for (unsigned ix = 0; ix != len; ix++)
+ {
+ const constructor_elt &elt = (*t->constructor.elts)[ix];
+
+ WT (elt.index);
+ WT (elt.value);
+ }
+ }
+
#undef WT
#undef WU
}
break;
case CONSTRUCTOR:
- if (unsigned len = u ())
- {
- vec_alloc (t->constructor.elts, len);
- for (unsigned ix = 0; ix != len; ix++)
- {
- constructor_elt elt;
-
- RT (elt.index);
- RTU (elt.value);
- t->constructor.elts->quick_push (elt);
- }
- }
+ // Streamed after the node's type.
break;
case OMP_CLAUSE:
t->typed.type = type;
}
+ if (TREE_CODE (t) == CONSTRUCTOR)
+ if (unsigned len = u ())
+ {
+ vec_alloc (t->constructor.elts, len);
+ for (unsigned ix = 0; ix != len; ix++)
+ {
+ constructor_elt elt;
+
+ RT (elt.index);
+ RTU (elt.value);
+ t->constructor.elts->quick_push (elt);
+ }
+ }
+
#undef RT
#undef RM
#undef RU
--- /dev/null
+// PR c++/105322
+// { dg-module-do link
+// { dg-additional-options -fmodules-ts }
+// { dg-module-cmi pr105322.Decltype }
+
+export module pr105322.Decltype;
+
+auto f() {
+ struct A { int m;
+ int get () { return m; }
+ };
+ return A{};
+}
+
+export
+inline void g1() {
+ auto r = decltype(f()){0};
+}
+
+export
+inline void g2() {
+ auto r = f().m;
+}
+
+export
+inline void g3() {
+ auto r = f().get();
+}
--- /dev/null
+// PR c++/105322
+// { dg-module-do link
+// { dg-additional-options -fmodules-ts }
+// { dg-module-cmi pr105322.Lambda }
+
+export module pr105322.Lambda;
+
+struct A { };
+
+export
+inline void f1() {
+ A a;
+ auto g1 = [a] { }; // used to ICE here during stream out
+}
+
+export
+template<class...>
+void f2() {
+ A a;
+ auto g2 = [a] { };
+}
+
+export
+inline auto g3 = [a=A{}] { };