For some reasons, I've always thought that deduction guides must have the same noexcept
-ness of the constructor to which they refer. For example:
template<typename T>
struct clazz {
clazz(const T &) noexcept {}
};
clazz(const char &) noexcept -> clazz<int>;
That is, if the constructor is noexcept
and I want it to be so also for const char &
, I have to add the noexcept
specifier to the deduction guide as well.
Today I worked a little with ICC and found that it has problems with noexcept
on deduction guides. So far, so good. I thought it was a bug of the compiler and that's it.
However, I went to look into the standard and couldn't find any point that confirms my initial assumption. Because of that, I checked the same against clang and even if it works without problems, it seems that the noexcept
on the deduction guide gets ignored in 100% of cases. On the other side, the one on the constructor affects both.
So, my question is, does it make any sense or is it required to somewhat propagate (if this makes sense at all) the noexcept
-ness of the constructor also to the deduction guide or is it useless and I can just get rid of all noexcept
on deduction guides?