This is the mail archive of the gcc-bugs@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]

c++/4908: Pointer to function type template arguments include default argument info

[Get raw message]

>Number:         4908
>Category:       c++
>Synopsis:       Pointer to function type template arguments include default argument info
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 19 13:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jaakko Jarvi
>Release:        3.0.2
>Organization:
Indiana University, Computer Science
>Environment:
System: SunOS trillian.osl.iu.edu 5.8 Generic_108528-09 sun4u sparc SUNW,Sun-Blade-100
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ./configure --prefix=/l/gcc302
>Description:
	Function default arguments should not be part of the pointer to 
	function type. However, when a type template parameter is instantiated
	with a pointer to function, information about default arguments seem
	to lurk in somewhat strangely.

	The following code compiles and runs:
        void foo(int i=1);
        template<class F> void call(F f) { f(); }

        The test program in the How-To-Repeat part is self explaining
>How-To-Repeat:

#include <iostream>

using namespace std;

void foo(int i = 1) { cout << "foo " << i << endl; } 

void bar(int i) { cout << "bar " << i << endl; } 

template <class F>
void call(F f, F g) { f(); g(); }

int main() {

  call(&foo, &bar);
  return 0;

}

>Fix:
	



>Release-Note:
>Audit-Trail:
>Unformatted:


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