GCC Bugzilla – Attachment 10225 Details for
Bug 24818
tr1::reference_wrapper improperly calls nullary function objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Mainline (4.1.0) patch to test and fix this problem
ref_wrap_nullary.patch (text/plain), 1.77 KB, created by
Doug Gregor
on 2005-11-12 13:31:04 UTC
(
hide
)
Description:
Mainline (4.1.0) patch to test and fix this problem
Filename:
MIME Type:
Creator:
Doug Gregor
Created:
2005-11-12 13:31:04 UTC
Size:
1.77 KB
patch
obsolete
>Index: include/tr1/ref_wrap_iterate.h >=================================================================== >RCS file: /cvs/gcc/gcc/libstdc++-v3/include/tr1/ref_wrap_iterate.h,v >retrieving revision 1.2 >diff -u -r1.2 ref_wrap_iterate.h >--- include/tr1/ref_wrap_iterate.h 17 Aug 2005 02:14:09 -0000 1.2 >+++ include/tr1/ref_wrap_iterate.h 12 Nov 2005 13:24:24 -0000 >@@ -40,5 +40,5 @@ > #else > typename result_of<_M_func_type()>::type > operator()() const >-{ return (*get())(); } >+{ return get()(); } > #endif >Index: testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc >=================================================================== >RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc,v >retrieving revision 1.2 >diff -u -r1.2 invoke.cc >--- testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc 17 Aug 2005 02:27:28 -0000 1.2 >+++ testsuite/tr1/3_function_objects/reference_wrapper/invoke.cc 12 Nov 2005 13:24:28 -0000 >@@ -56,11 +56,20 @@ > X& operator=(const X&); > }; > >+int seventeen() { return 17; } >+ >+struct get_seventeen >+{ >+ typedef int result_type; >+ int operator()() const { return 17; } >+}; >+ > void test01() > { > using std::tr1::ref; > using std::tr1::cref; > >+ ::get_seventeen get_sev; > ::X x; > ::X* xp = &x; > int (::X::* p_foo)(float) = &::X::foo; >@@ -73,9 +82,11 @@ > > // Functions > VERIFY(ref(truncate_float)(pi) == 3); >+ VERIFY(ref(seventeen)() == 17); > > // Function pointers > VERIFY(cref(&truncate_float)(pi) == 3); >+ VERIFY(cref(&seventeen)() == 17); > > // Member function pointers > VERIFY(ref(p_foo)(x, pi) == 3); >@@ -92,6 +103,8 @@ > VERIFY(ref(p_bar)(xp) == 17); > > // Function objects >+ VERIFY(ref(get_sev)() == 17); >+ VERIFY(cref(get_sev)() == 17); > VERIFY(ref(x)(pi) == 4); > VERIFY(cref(x)(pi) == 5); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 24818
: 10225