[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

Maksim Levental via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 23:49:00 PDT 2023


================
@@ -257,14 +256,9 @@ const char *const Runtimes = R"(
     void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
     void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long long);
     template <class T, class = T (*)() /*disable for arrays*/>
-    void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned long Size) {
----------------
makslevental wrote:

> We can’t outline templates because we are introducing an odr violation.

This is not correct - templates (subject to conditions satisfied here) are exempt from odr:

> There can be more than one definition of a [...] templated entity ([temp.pre]) [...] in a program provided that each definition appears in a different translation unit and the definitions satisfy the following requirements.

https://timsong-cpp.github.io/cppwp/n4861/basic.def.odr#13

> We should move new behind a new non-templates operation which we can forward declare and use within the template.

I don't know what you're describing here; feel free to take over this PR if you have a concrete design in mind.

https://github.com/llvm/llvm-project/pull/69072


More information about the cfe-commits mailing list