-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter: Lénárd Szolnoki
Reference (section label): [over.best.ics.general]/2
Issue description
There are several issues with the wording of [over.best.ics.general]/2:
Implicit conversion sequences are concerned only with the type, cv-qualification, and value category of the argument and how these are converted to match the corresponding properties of the parameter.
Problem 1: Implicit conversion sequences are not concerned whether argument is null pointer constant or not
From the wording it follows that implicit conversion sequences are not concerned whether or not an argument is a null pointer constant or not. From this reading a function call like foo(0)
should not find void foo(void*)
viable, as there is no implicit conversion sequence from a prvalue of type int
to void *
.
This conflicts with implementations in major compilers:
void foo(void *, int); // 1
void foo(short, short); // 2
void bar() {
foo(0, 1); // calls first overload
}
https://godbolt.org/z/E8zME93cc
Problem 2: The description of conversion from the argument to the parameter is imprecise
The wording describes that each of cv, type and value category is converted to match the "corresponding property" of the parameter (so cv, type and ... parameters don't have value category). I don't think the standard defines how cv, type and value category are converted individually. It particularly does not make much sense for value category.
Problem 3: The paragraph only covers arguments that have cv-qualification, type and value category
Some arguments are not expressions. Initializer-lists lack all three of these properties.
An id-expression to a function or an address of an id-expression to a function may not have a definitive type, due to overload sets.
Edits
- I edited the description to include other problems with the wording besides the null pointer constant one. I deleted my suggested resolution, as it does not tackle all of these problems.