This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13478] New: gcc uses wrong constructor to initialize a const reference
- From: "erich_guenther at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2003 14:33:07 -0000
- Subject: [Bug c++/13478] New: gcc uses wrong constructor to initialize a const reference
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#define FAILS
/* gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux)
tzst2.cpp: In function `void foo(const SA*)':
tzst2.cpp:29: error: `CA::CA(const CA&)' is private
tzst2.cpp:34: error: within this context
tzst2.cpp:34: error: initializing temporary from result of `CA::CA(const SA&)
*/
// Data layout only
struct SA
{
};
class CA :protected SA
{
public:
CA()
{
};
CA(const SA& a)
{
};
#ifdef FAILS
private:
CA(const CA& a);
#endif
};
void foo(const SA * pa)
{
const CA& ra=*pa;
}
--
Summary: gcc uses wrong constructor to initialize a const
reference
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: erich_guenther at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13478