This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41073] New: Array of iostreams
- From: "philippe at fornux dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Aug 2009 19:52:10 -0000
- Subject: [Bug c++/41073] New: Array of iostreams
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Initialization of an array mistakenly calls the copy constructor:
#include <iostream>
std::iostream a[] = {std::iostream(0)};
int main()
{
}
Returns:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:
In copy constructor 'std::basic_ios<char, std::char_traits<char>
>::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:779:
error: 'std::ios_base::ios_base(const std::ios_base&)' is private
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:55:
error: within this context
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd: In
copy constructor 'std::basic_iostream<char, std::char_traits<char>
>::basic_iostream(const std::basic_iostream<char, std::char_traits<char> >&)':
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:67:
note: synthesized method 'std::basic_ios<char, std::char_traits<char>
>::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)' first
required here
arrayinit.cpp: At global scope:
arrayinit.cpp:6: note: synthesized method 'std::basic_iostream<char,
std::char_traits<char> >::basic_iostream(const std::basic_iostream<char,
std::char_traits<char> >&)' first required here
--
Summary: Array of iostreams
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe at fornux dot com
GCC build triplet: gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
GCC host triplet: Linux 2.6.18-128.4.1.el5 #1 SMP
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41073