public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19170] New: Compilation error at a vector definition
@ 2004-12-27 19:43 rjimenez at ujaen dot es
2004-12-27 19:46 ` [Bug c++/19170] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: rjimenez at ujaen dot es @ 2004-12-27 19:43 UTC (permalink / raw)
To: gcc-bugs
Hi,
The compiler (g++ 3.4.2) gives me an error when i write:
B b;
vector<A>elemA(2, b);
B can be, for instance, a pointer to an integer, or a class. A is defined as:
class A{
public:
A(B b) {}
private:
A(const A&){} //!< disallow copying
A& operator=(const A&){ return const_cast<A&>(*this);} //!< disallow copying
};
The strange thing is that the constructor i am invoking is the public one not
the private. The compilation is fine when B is an integer.
The message of the compiler is:
g++ -g -Wall -c main.cc -o main.o
main.cc: In function `void std::_Construct(_T1*, const _T2&) [with _T1 = A, _T2
= A]':
/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_uninitialized.h:194:
instantiated from `_ForwardIterator
std::__uninitialized_fill_n_aux(_ForwardIterator, _Size, const _Tp&,
__false_type) [with _ForwardIterator = A*, _Size = long unsigned int, _Tp = A]'
/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_uninitialized.h:219:
instantiated from `_ForwardIterator
std::uninitialized_fill_n(_ForwardIterator, _Size, const _Tp&) [with
_ForwardIterator = A*, _Size = long unsigned int, _Tp = A]'
/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_vector.h:194:
instantiated from `std::vector<_Tp, _Alloc>::vector(size_t, const _Tp&, const
typename std::_Vector_base<_Tp, _Alloc>::allocator_type&) [with _Tp = A, _Alloc
= std::allocator<A>]'
main.cc:33: instantiated from here
main.cc:21: error: `A::A(const A&)' is private
/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/bits/stl_construct.h:81:
error: within this context
make: *** [main.o] Error 1
Thanks in advance.
Roberto.
--
Summary: Compilation error at a vector definition
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rjimenez at ujaen dot es
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: x86-64
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19170
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/19170] Compilation error at a vector definition
2004-12-27 19:43 [Bug c++/19170] New: Compilation error at a vector definition rjimenez at ujaen dot es
@ 2004-12-27 19:46 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-27 19:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-27 19:46 -------
Not a bug, again read the release notes.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19170
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-27 19:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-27 19:43 [Bug c++/19170] New: Compilation error at a vector definition rjimenez at ujaen dot es
2004-12-27 19:46 ` [Bug c++/19170] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).