aganea wrote: > Hmm, I haven't thought deeply about these kinds of things in a while, so I'm > struggling to wrap my head around this. > > > I think it's fine to accept the example above since the body of the > > function will be discarded anyway; and the inlined version of the function > > will contain a reference to the imported function-static symbol, like MSVC > > does > > Why does it matter whether the function gets inlined or not?
Because the behavior is not the same, however the address of the local static must remain the same in both cases: - If the function is dllimport'ed, the whole body must be discarded in the current TU, and an indirect call is made, ie. `call qword ptr [?pfoo@@3P6APEBHXZEA`] - If the function is inlined, the address of the local-static must be imported, ie `call qword ptr [?pfoo@@3P6APEBHXZEA]` > Despite the `__forceinline` I don't think it's guaranteed to get inlined, and > in your change to ExprConstant.cpp, you're not checking for it anyway? The above was only a observation I couldn't make before, because of the compilation error (in the description above). That observation is unrelated with my change. https://github.com/llvm/llvm-project/pull/171628 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
