This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
questions about cv-qulifier for function.
- From: zhang qingshan <steven dot zhang54373 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 1 Dec 2010 18:28:11 +0800
- Subject: questions about cv-qulifier for function.
Hi, team
Question 1:
std(N3000=09-0190) 8.3.5/6 says that:
A cv-qualifier-seq shall only be part of the function type for a
non-static member function, the function type to which a pointer to
member refers, or the top-level function type of a function typedef
declaration.
const void func();
can be compiled successfully for GCC 4.5.0. However, I am confused about that:
the const here doesn't belong to the three types which std allows. Why
it is well-form?
Question 2:
std(N3000=09-0190) 8.3.2/1 says that:
Cv-qualified references are ill-formed except when the cv-qualifiers
are introduced through the use of a typedef (7.1.3) or of a template
type argument (14.4), in which case the cv-qualifiers are ignored.
int m = 3;
const int &t = m;
can be compiled successfully for GCC 4.5.0. But std says that
cv-qualified references are not allowed to introduce except through
the use of typedef or template type argument. In this case , it is
allowed, why?
Thanks.