In the C ++ standard, the description of is_constructible has this innocent looking quote:
Only the reliability of the immediate context of the initialization of the variable [imaginary v ] is considered.
And then a note explaining what this means:
Initialization evaluation can lead to such as creating instances of specialized class templates and specialized function templates, generating implicitly defined functions, etc. Such side effects are not in the immediate context and can lead to a bad form of the program.
My interpretation is that when you write:
aggregate_wrapper<foo_t> v;
You use the default constructor aggregate_wrapper , it exists and is available, so it succeeds, at least in the immediate context. Then the non-femoral context includes the constructor body, and this fails, but this does not change the result of is_constructible .
rodrigo
source share