TITLE: cv qualifiers and function overloading (Newsgroups: comp.lang.c++.moderated, 11 Jun 98) FVALI: fvali >> > void f(int); >> > >> > void f(const int); OLIVA: Alexandre Oliva >> These are two equivalent declarations of the same function, with >> signature void(int), not an example of overloading. The outermost >> cv-qualification affects the argument inside the function body, but >> not the signature of the function [dcl.fct]/3. FVALI: fvali@my-dejanews.com >In article <6lgmjg$jmj@netlab.cs.rpi.edu>, >Yet don't f(int&) and f(const int&) produce different signatures? CLAMAGE: clamage@Eng.Sun.COM (Steve Clamage) Yes, but for different reasons. FVALI: >The Dec 96 draft says this: >[Begin Draft Quote: >8.3.5(3) >The type of a function is determined using the follow- > ing rules. The type of each parameter is determined from its own > decl-specifier-seq and declarator. After determining the type of each > parameter, any parameter of type "array of T" or "function returning > T" is adjusted to be "pointer to T" or "pointer to function returning > T," respectively. After producing the list of parameter types, sev- > eral transformations take place upon these types to determine the > function type. Any cv-qualifier modifying a parameter type is > deleted; e.g., the type void(const int) becomes void(int). Such cv- > qualifiers only affect the definition of the parameter within the body > of the function; they do not affect the function type. >:End Draft Quote] CLAMAGE: The cv-qualifiers that are removed are the "outermost", i.e. the ones that apply to the parameter itself. In "const int", the const modifies the type of the parameter. In "const int&", the const modifies the type that the parameter refers to. Probably the wording in the draft could be better.