c++/10807: [DR 295] It is possible to cv-qualify references even to function types, if the CV qualifications are introduced through a typedef or a template argument

giovannibajo@libero.it giovannibajo@libero.it
Thu May 15 18:36:00 GMT 2003


>Number:         10807
>Category:       c++
>Synopsis:       [DR 295] It is possible to cv-qualify references even to function types, if the CV qualifications are introduced through a typedef or a template argument
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu May 15 18:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Giovanni Bajo
>Release:        3.4
>Organization:
>Environment:
i686-pc-cygwin
>Description:
The following code is legal as per approval of DR 295:

-------------------------------------------------
// CV qualifications through typedefs are ok (and ignored)
typedef void func_type(int);
typedef const volatile func_type cv_func_type;

void func(int) {}
cv_func_type* func_ptr = func;


// CV qualifications through template arguments are ok (and ignored)
template <typename T>
void bar(const volatile T& p)
{
    typedef const volatile T cvT;
    cvT* func = p;

    func(10);
}

int main()
{
    bar(func);
}
-------------------------------------------------
dr295.cpp:3: error: `const volatile' qualifiers cannot be applied to `void ()(int)'
dr295.cpp: In function `int main()':
dr295.cpp:21: error: no matching function for call to `bar(void (&)(int))'


Please, notice that c++/3518 is surely related to this PR.
So, once this is implemented, c++/3518 should be checked
again.
>How-To-Repeat:
Compile the above snippet
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list