Title
Overloading and deprecated conversion of string literal
Status
tc1
Section
12.2.4.3 [over.ics.rank]
Submitter
Steve Adamczyk

Created on 1999-01-24.00:00:00 last changed 255 months ago

Messages

Date: 2000-10-15.00:00:00

Proposed resolution (10/00):

Change 12.2.4.3 [over.ics.rank] bullet 3.1 sub-bullet 3 from

S1 and S2 differ only in their qualification conversion and yield similar types T1 and T2 (7.3.6 [conv.qual] ), respectively, and the cv-qualification signature of type T1 is a proper subset of the cv-qualification signature of type T2.
to
S1 and S2 differ only in their qualification conversion and yield similar types T1 and T2 (7.3.6 [conv.qual] ), respectively, and the cv-qualification signature of type T1 is a proper subset of the cv-qualification signature of type T2, and S1 is not the deprecated string literal array-to-pointer conversion (7.3.3 [conv.array] ).
Date: 2003-04-25.00:00:00

In 12.2.4.3 [over.ics.rank] , we have

  • S1 and S2 differ only in their qualification conversion and yield similar types T1 and T2 (7.3.6 [conv.qual] ), respectively, and the cv-qualification signature of type T1 is a proper subset of the cv-qualification signature of type T2, [Example:
        int f(const int *);
        int f(int *);
        int i;
        int j = f(&i); // Calls f(int *)
    
    end example] or, if not that,
This does not work right with respect to the deprecated conversion from string literal to "char *". Consider
    void f(char *);
    void f(const char *);

    f("abc");
The two conversion sequences differ only in their qualification conversions, and the destination types are similar. The cv-qualification signature of "char *", is a proper subset of the cv-qualification signature of "const char *", so f(char *) is chosen, which is wrong. The rule should be like the one for conversion to bool — the deprecated conversion should be worse than another exact match that is not the deprecated conversion.
History
Date User Action Args
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetstatus: review -> ready
2000-02-23 00:00:00adminsetmessages: + msg229
2000-02-23 00:00:00adminsetstatus: open -> review
1999-01-24 00:00:00admincreate