On 1 December 2010 10:28, zhang qingshan wrote: > Hi, team This sort of question should be sent the mailing list gcc-h...@gcc.gnu.org, not the mailing list g...@gcc.gnu.org. gcc@gcc.gnu.org is for the development of gcc itself. Please take any future questions about using gcc to gcc-help. Thanks.
> Question 1: > > std(N3000=09-0190) 8.3.5/6 says that: N3000 is not a standard, it's only a draft, and N3126 is the latest draft. > 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? The const is not part of the function type, it's part of the return type, and is ignored. > 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? That is not a const-qualified reference, it's a reference to const int. Please take any further questions to the gcc-help list or a C++ forum. Thanks, Jonathan