------- Comment #7 from mec at google dot com  2007-05-30 23:01 -------
I think the problem is independent of __is_pod.  The new
std::uninitialized_fill has an "if" statement, not a template specialization. 
Compilation always attempts to instantiate std::fill(__first_, __last_, __x),
whether that line is executed at run-time or not.

Here is an example with a class that is clearly not a POD.

===

#include <memory>

class Foo {
  public:
    Foo();
    Foo(const Foo&);
    ~Foo();
  private:
    void* p;
    void operator=(const Foo&);
};

void Alpha(Foo* start, Foo* end) {
  Foo f;
  std::uninitialized_fill(start, end, f);
}

[EMAIL PROTECTED]:~/exp-43-redux$ /home/mec/gcc-4.2.0/install/bin/g++ -Wall -S
u-fill-2.cc 

[EMAIL PROTECTED]:~/exp-43-redux$ /home/mec/gcc-4.3-20070525/install/bin/g++ 
-Wall
-S u-fill-2.cc 
u-fill-2.cc: In static member function 'static void std::__fill<<anonymous>
>::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator
= Foo*, _Tp = Foo, bool <anonymous> = false]':
/home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:557:
  instantiated from 'void std::__fill_aux(_ForwardIterator, _ForwardIterator,
const _Tp&) [with _ForwardIterator = Foo*, _Tp = Foo]'
/home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:595:
  instantiated from 'void std::fill(_ForwardIterator, _ForwardIterator, const
_Tp&) [with _ForwardIterator = Foo*, _Tp = Foo]'
/home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_uninitialized.h:146:
  instantiated from 'void std::uninitialized_fill(_ForwardIterator,
_ForwardIterator, const _Tp&) [with _ForwardIterator = Foo*, _Tp = Foo]'
u-fill-2.cc:15:   instantiated from here
u-fill-2.cc:10: error: 'void Foo::operator=(const Foo&)' is private
/home/mec/gcc-4.3-20070525/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_algobase.h:533:
error: within this context

[EMAIL PROTECTED]:~/exp-43-redux$ 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32158

Reply via email to