This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
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
- From: giovannibajo at libero dot it
- To: gcc-gnats at gcc dot gnu dot org
- Cc: nathan at codesourcery dot com
- Date: 15 May 2003 18:08:31 -0000
- Subject: 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
- Reply-to: giovannibajo at libero dot it
>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: