Is an explicit type conversion a conversion or not?

21 views
Skip to first unread message

Johannes Schaub

unread,
Jun 24, 2017, 5:47:45 AM6/24/17
to std-dis...@isocpp.org
[Class.conv] says

"Type conversions of class objects can be specified by constructors
and by conversion functions. These conversions are called user-defined
conversions and are used for implicit type conversions (Clause
[conv]), for initialization, and for explicit type conversions
([expr.cast], [expr.static.cast])."

But a few paragraphs later it says

"A constructor declared without the function-specifier explicit
specifies a conversion from the types of its parameters (if any) to
the type of its class. Such a constructor is called a converting
constructor."

What does the combination of both mean? Does a non-explicit
constructor specify a conversion from the type of its parameter to the
type of its class. But an explicit constructor specifies a conversion
from an unspecified type to an unspecified type?

So far I was in the impression that only non-explicit constructors
actually specifies *conversions* (user-defined conversions), and that
explicit constructors can be used in explicit type conversion syntax,
but that these are not really "conversions". But the first sentence of
[class.conv] uses the term "conversion" for any constructor, seemingly
contradicting the later paragraph.
Reply all
Reply to author
Forward
0 new messages