This is the mail archive of the gcc-prs@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: c++/8503: strange behaviour of function types.


The following reply was made to PR c++/8503; it has been noted by GNATS.

From: "John Maddock" <john_maddock@compuserve.com>
To: <paolo@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>,
	<john_maddock@compuserve.com>,
	<nobody@gcc.gnu.org>,
	<gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/8503: strange behaviour of function types.
Date: Sat, 9 Nov 2002 11:20:17 -0000

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0026_01C287E1.FB7F23C0
 Content-Type: text/plain;
 	charset="iso-8859-1"
 Content-Transfer-Encoding: 7bit
 
 >     Unfortunately, the example code got lost.
 >     Could you possibly send it to me privately? I will complete
 >     the PR with it.
 >     Thanks, Paolo.
 
 See attached.
 ------=_NextPart_000_0026_01C287E1.FB7F23C0
 Content-Type: application/octet-stream;
 	name="Gcc_bug.cpp"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="Gcc_bug.cpp"
 
 
 #include <iostream>
 
 template <class T>
 struct is_const
 {
 	static void check()
 	{ std::cout << "non-const\n"; }
 };
 
 template <class T>
 struct is_const<T const>
 {
 	static void check()
 	{ std::cout << "const\n"; }
 };
 
 template <class T>
 void overload_reference(T&)
 {std::cout << "non-const\n"; }
 
 template <class T>
 void overload_reference(const volatile T&)
 {std::cout << "const\n"; }
 
 template <class T>
 void overload_pointer(T*)
 {std::cout << "non-const\n"; }
 
 template <class T>
 void overload_pointer(const volatile T*)
 {std::cout << "const\n"; }
 
 int sample_proc(int)
 {
 return 0;
 }
 
 int main()
 {
 	typedef int (foo_type)(int);
 	is_const<foo_type>::check();
 	foo_type& f = sample_proc;
 	overload_reference(f);
 	foo_type* pf = &f;
 	overload_pointer(pf);
 }
 
 
 
 ------=_NextPart_000_0026_01C287E1.FB7F23C0--
 
 


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