This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: const qualifier for function type


> From: iant@google.com
> Nathan Ridge writes:
>
> > Is the code ill-formed and gcc thus non-conforming?
>
> Those are two separate questions, 
 
Doesn't accepting invalid code make a compiler non-conforming?
 
 
> but as far as I can tell, this code is
> indeed ill-formed, and gcc should give an error for it. Please consider
> filing an accepts-valid bug as described at http://gcc.gnu.org/bugs/ .

I have filed http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48409.
 

> > I ask because libstdc++ uses specializations like this for std::is_function in ,
> > and as a result, clang refuses to compile anything that includes .
>
> I don't see that in the current . I see something
> different in : the function is a template parameter. The
> const qualifier is permitted if the function type is a
> pointer-to-member. I think that may be possible in . In
> that case, the const qualifier is not an error, and any use of it with
> something that is not a pointer-to-member should be dropped due to
> SFINAE. But I am not a C++ expert, and I could be wrong here.

I was referring to the following:
 
  template<typename>
    struct is_function
    : public false_type { };
  template<typename _Res, typename... _ArgTypes>
    struct is_function<_Res(_ArgTypes...)>
    : public true_type { };
  template<typename _Res, typename... _ArgTypes>
    struct is_function<_Res(_ArgTypes...) const>
    : public true_type { };

 
Regards,
Nate. 		 	   		  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]