Defect Report #111
Submission Date: 03 Dec 93
Source: Ron Guilmette
ANSI/ISO C Defect report #rfg18:
Subject: Conversion of pointer-to-qualified type values to type (void*)
Does the following code involve usage which requires a diagnostic
from a standard conforming implementation?
const char *ccp;
void test ()
vp = ccp; /* diagnostic required? */
With respect to this example, the following quotations are relevant.
A pointer to void may be converted
to or from a pointer to any incomplete or object type.
Subclause 220.127.116.11 (Constraints):
One of the following shall hold:
The rule specified in subclause 18.104.22.168 (and quoted above) makes it
unclear whether a value of some pointer-to-qualified-object type may
be first implicitly converted to type (void*) and then
assigned to a type (void*) variable, or whether such implicit
conversion only takes place as an integral part of an otherwise valid
- both operands are pointers to qualified or unqualified
versions of compatible types, and the type pointed to by the left
has all the qualifiers of the type pointed to by the right;
- one operand is a pointer to an object or incomplete type
and the other is a pointer to a qualified or unqualified version of
void, and the type pointed to by the left has all the qualifiers
of the type pointed to by the right; ...
If the former interpretation of subclause 22.214.171.124 is correct, then
the above code example is valid, and no diagnostic is required. If,
however, the latter interpretation is the correct one, then the code
example shown above fails to meet the constraints of subclause 126.96.36.199,
and (thus) a diagnostic is required.
The constraint in subclause 188.8.131.52 takes precedence over subclause
184.108.40.206; therefore a diagnostic is required. Note that the above quote
from subclause 220.127.116.11 is incomplete and taken out of context.
Previous Defect Report
< - >
Next Defect Report