https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94314
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #5) > I don't think we need heavy machinery linking new and delete (and if we did > I'd be tempted to store it in some global table rather than in the nodes). > The most important case is the global replacable functions, for which we > have a finite list, and for those a few checks like not matching array with > non-array versions should do. For user overloads with attribute malloc (a > gcc extension), I would go with heuristics like both/neither being class > members, being members of the same class, etc. Although I am not quite sure > how doable that is from the middle-end, how much of that information is > still available (I think it is available in the mangled name, but demangling > doesn't seem like a great idea). It should be sufficient to check whether they have the same DECL_CONTEXT.