jamboree / bustache

C++20 implementation of {{ mustache }}
82 stars 10 forks source link

Resolve #11: qualify calls to bustache::visit to avoid wrong overload #12

Closed sjoubert closed 6 years ago

sjoubert commented 6 years ago

The visit implementation provided by bustache are not in the exact namespace as the parameters preventing ADL to correctly choose the bustache implementation in some cases. When std::visit from C++17 is also in scope it is preferred. Qualifying the visit calls to force the bustache implementation.

jamboree commented 6 years ago

Weird. Those classes inherit from variant_base, which should be enough for ADL, not sure why std::visit is preferred. VS2017 in c++17 mode doesn't report errors though.

sjoubert commented 6 years ago

According to https://stackoverflow.com/questions/41754425/use-adl-swap-of-base-class#41754492 the conversion to the base class makes it a worse match than std:: which is a direct template instantiation.

But it's still weird that all compilers do not agree.

jamboree commented 6 years ago

I'm not sure if it's the problem, given that this code compiles well.