-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Description
Expected Behavior
See "detailed" not_bound errors
Actual Behavior
See nothing, only a linker error
gcc 12.2
clang 15
similar to:
#458
Question
I wonder myself why we have the following code (and why its so magic :-D)
template <class T>
struct abstract_type {
struct is_not_bound {
operator T*() const {
using constraint_not_satisfied = is_not_bound;
return constraint_not_satisfied{}.error();
}
// clang-format off
static inline T*
error(_ = "type is not bound, did you forget to add: 'di::bind<interface>.to<implementation>()'?");
// clang-format on
};
template <class TName>
struct named {
struct is_not_bound {
operator T*() const {
using constraint_not_satisfied = is_not_bound;
return constraint_not_satisfied{}.error();
}
// clang-format off
static inline T*
error(_ = "type is not bound, did you forget to add: 'di::bind<interface>.named(name).to<implementation>()'?");
// clang-format on
};
};
};How about replacing with a static_assert?
template <class T>
struct abstract_type {
struct is_not_bound {
static_assert(T::_, "type is not bound, did you forget to add: 'di::bind<interface>.to<implementation>()'?");
};
template <class TName>
struct named {
struct is_not_bound {
static_assert(T::_ || TName::_, "type is not bound, did you forget to add: 'di::bind<interface>.named(name).to<implementation>()'?"));
};
};
};Metadata
Metadata
Assignees
Labels
No labels