help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compilation problem when upgrading from g++ 3.3 to g++ 3.4


From: Alex Vinokur
Subject: Compilation problem when upgrading from g++ 3.3 to g++ 3.4
Date: Tue, 16 Nov 2004 09:36:01 +0200

Hi,

The code below has no problem with GNU g++ 3.3,
but it has a problem with GNU g++ 3.4.

Any suggestions?

------ foo.cpp ------
#include <vector>
using namespace std;

typedef char foo_t[3];
#define ELEM1 "ab"
#define ELEM2 "cd"

const foo_t a[] = {ELEM1, ELEM2};
const vector<foo_t> v = vector<foo_t>(a, a + sizeof (a)/sizeof (*a));

int main()
{
  return 0;
}
---------------------



------ Compilation with GNU gcc 3.3 (Cygwin) : BEGIN ------

$ g++ --version
g++ (GCC) 3.3.3 (cygwin special)
[---omitted---]

$ g++ -W -Wall foo.cpp
// No errors/warnings

------ Compilation with GNU gcc 3.3 (Cygwin) : END --------



------ Compilation with GNU gcc 3.4 (DJGPP) : BEGIN ------

$ gpp --version
gpp.exe (GCC) 3.4.1
[---omitted---]


$ gpp -W -Wall foo.cpp
c:/djgpp/bin/../lib/gcc/djgpp/3.41/../../../../include/cxx/3.41/bits/stl_construct.h:
 In function `void std::_Construct(_T1*, const
_T2&) [with _T1 = char[3], _T2 = char[3]]':
c:/djgpp/bin/../lib/gcc/djgpp/3.41/../../../../include/cxx/3.41/bits/stl_uninitialized.h:86:
   instantiated from `_ForwardIterator
std::__uninitialized_copy_aux(_InputIterator, _InputIterator, _ForwardIterator, 
__false_type) [with _InputIterator =
__gnu_cxx::__normal_iterator<const char (*)[3], std::vector<char[3], 
std::allocator<char[3]> > >, _ForwardIterator = char (*)[3]]'
c:/djgpp/bin/../lib/gcc/djgpp/3.41/../../../../include/cxx/3.41/bits/stl_uninitialized.h:112:
   instantiated from `_ForwardIterator
std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with 
_InputIterator = __gnu_cxx::__normal_iterator<const
char (*)[3], std::vector<char[3], std::allocator<char[3]> > >, _ForwardIterator 
= char (*)[3]]'
c:/djgpp/bin/../lib/gcc/djgpp/3.41/../../../../include/cxx/3.41/bits/stl_vector.h:221:
   instantiated from `std::vector<_Tp,
_Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = char[3], _Alloc = 
std::allocator<char[3]>]'
foo.cpp:9:   instantiated from here
c:/djgpp/bin/../lib/gcc/djgpp/3.41/../../../../include/cxx/3.41/bits/stl_construct.h:81:
 error: ISO C++ forbids initialization in
array new

------ Compilation with GNU gcc 3.4 (DJGPP) : END --------

-- 
 Alex Vinokur
     email: alex DOT vinokur AT gmail DOT com
     http://mathforum.org/library/view/10978.html
     http://sourceforge.net/users/alexvn





reply via email to

[Prev in Thread] Current Thread [Next in Thread]