We need to remember that the ::operator new is replaceable to avoid a bogus
error about __builtin_operator_new finding a non-replaceable function.
This affected __get_temporary_buffer in stl_tempbuf.h.
gcc/cp/ChangeLog:
* module.cc (trees_out::core_bools): Write replaceable_operator.
(trees_in::core_bools): Read it.
gcc/testsuite/ChangeLog:
* g++.dg/modules/operator-2_a.C: New test.
* g++.dg/modules/operator-2_b.C: New test.
WB (t->function_decl.has_debug_args_flag);
WB (t->function_decl.versioned_function);
+ WB (t->function_decl.replaceable_operator);
/* decl_type is a (misnamed) 2 bit discriminator. */
unsigned kind = t->function_decl.decl_type;
RB (t->function_decl.has_debug_args_flag);
RB (t->function_decl.versioned_function);
+ RB (t->function_decl.replaceable_operator);
/* decl_type is a (misnamed) 2 bit discriminator. */
unsigned kind = 0;
--- /dev/null
+// { dg-additional-options -fmodules }
+// { dg-module-cmi M }
+
+module;
+
+#include <new>
+
+export module M;
+
+export template <class T>
+inline T* alloc (__SIZE_TYPE__ n)
+{
+ return (T*) __builtin_operator_new (n * sizeof (T), std::nothrow_t{});
+};
--- /dev/null
+// { dg-additional-options -fmodules }
+
+import M;
+
+int main()
+{
+ int *p = alloc<int>(42);
+}