This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
fix malloc_allocator, rfc c++ front end bug?
- From: Richard Henderson <rth at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 4 Dec 2004 14:59:54 -0800
- Subject: fix malloc_allocator, rfc c++ front end bug?
On alpha-linux, I get
FAIL: ext/malloc_allocator/check_allocate_max_size.cc (test for excess errors)
FAIL: ext/malloc_allocator/check_deallocate_null.cc (test for excess errors)
include/ext/malloc_allocator.h: In member function '_Tp* __gnu_cxx::malloc_allocator<_Tp>::allocate(size_t, const void*)':
include/ext/malloc_allocator.h:88: error: there are no arguments to 'malloc' that depend on a template parameter, so a declaration of 'malloc' must be available
include/ext/malloc_allocator.h:88: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
include/ext/malloc_allocator.h: In member function 'void __gnu_cxx::malloc_allocator<_Tp>::deallocate(_Tp*, size_t)':
include/ext/malloc_allocator.h:97: error: there are no arguments to 'free' that depend on a template parameter, so a declaration of 'free' must be available
include/ext/malloc_allocator.h: In member function '_Tp* __gnu_cxx::malloc_allocator<_Tp>::allocate(size_t, const void*) [with _Tp = main::value_type]':
testsuite/testsuite_allocator.h:220: instantiated from 'bool __gnu_test::check_allocate_max_size() [with Alloc = main()::allocator_type]'
testsuite/ext/malloc_allocator/check_allocate_max_size.cc:29: instantiated from here
include/ext/malloc_allocator.h:88: error: 'malloc' was not declared in this scope
I have absolutely no idea why this isn't failing IN THE TESTSUITE for
i686-linux. If I preprocess the test case on i686 and then run the .i
file through the compiler, I do get these same errors. I can only imagine
that it's a bug in the front end somehow, but I don't have a clue how
to go about showing that.
Ok?
r~
* include/ext/malloc_allocator.h: Include cstdlib.
Index: include/ext/malloc_allocator.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/malloc_allocator.h,v
retrieving revision 1.11
diff -c -p -d -r1.11 malloc_allocator.h
*** include/ext/malloc_allocator.h 24 Nov 2004 04:11:13 -0000 1.11
--- include/ext/malloc_allocator.h 4 Dec 2004 18:20:12 -0000
***************
*** 34,39 ****
--- 34,40 ----
#ifndef _MALLOC_ALLOCATOR_H
#define _MALLOC_ALLOCATOR_H 1
+ #include <cstdlib>
#include <new>
#include <bits/functexcept.h>