These are chat archives for boostorg/hana

26th
Jun 2016
Louis Dionne
@ldionne
Jun 26 2016 23:24
I would say that’s a bug.. and I would urge you to report it.
Here’s a minimal failing example:
#include <type_traits>

template <long long n> struct explode : explode<n - 1> { };
template <>            struct explode<0> { };

template <typename Condition>
constexpr auto get(Condition) {
  if constexpr(Condition::value)
    return explode<258>{};
  else
    return;
}

int main() {
    get(std::false_type{});
}
Ah ah! On the other hand, the following works:
#include <type_traits>

template <long long n> struct explode : explode<n - 1> { };
template <>            struct explode<0> { };

template <typename Condition>
constexpr auto get(Condition) {
  if constexpr(Condition::value)
    return explode<Condition::value ? 258 : 258>{};
  else
    return;
}
int main() {
    get(std::false_type{});
}
So, it seems that the discarded-statement is not instantiated if it’s somehow dependent, but otherwise it is instantiated. It could be either a misunderstanding of how the proposal work or a bug in Clang, but in both cases I would encourage you to submit a bug report to Clang and to share the link here so I can watch the bug report.