This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13478] New: gcc uses wrong constructor to initialize a const reference


#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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]