xeus-cling
xeus-cling copied to clipboard
Avoid injecting template to ADL
The current default implementation of mime_bundle_repr
injects a template to the Argument Dependent Lookup. This is very inconvenient because the user may also want to also provide a templated function. Unfortunately, this will fail in the overload resolution stage because of ambiguity (see https://godbolt.org/z/n9xxE44TW). Therefore (based on https://godbolt.org/z/Gsr1fq6TM), I propose a concept check that test if the user provided her own mime_bundle_repr
and if so dispatch it to the display data, otherwise, call the fallback implementation.
@dokempf would you help me fixing the CI? I have no local setup to try this out.
We fixed the CI. In case @SoilRos 's Godbolt examples are not exposing the existing problem enough, here is a very minimal example (a trimmed down version of actual code) that shows the issue:
Note that providing an overload for A
specifically is not a viable solution for us as the actual code needs to be based on a concept check (see code in ->decltype(...
comments).
This PR was automatically closed when I renamed the master branch into main, sorry for that. You can reopen it to the main branch, I will review it.