public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8389: Cannot access protected member in base class
@ 2002-10-28 18:06 dv
  0 siblings, 0 replies; only message in thread
From: dv @ 2002-10-28 18:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: dv


>Number:         8389
>Category:       c++
>Synopsis:       Cannot access protected member in base class
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 28 18:06:29 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Detlef Vollmann
>Release:        3.3 20021027 (experimental)
>Organization:
vollmann engineering gmbh
>Environment:
System: Linux dwarf 2.4.3-XFS #7 Mon Aug 6 18:43:20 CEST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /pdsrc/gcc/cvs/gcc/configure --program-suffix=-test --prefix=/local/gcc-test --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-languages=c,c++
>Description:
	For the attached program, g++ gives the error message:
	test.cc: In member function `Derived<T> Derived<T>::f() const [with T = char]':
	test.cc:30:   instantiated from here
	test.cc:6: error: `typedef int Base<char>::Type' is protected
	test.cc:23: error: within this context

>How-To-Repeat:
	just compile attached source (g++ -c test.cc)
>Fix:
	

//test.cc:
template <class>
class Base
{
protected:
    typedef int Type;
};

template <class T>
class Derived : public Base<T>
{
public:
    typedef Base<T> BaseT;

    typedef typename BaseT::Type Type;

    template <class Arg>
    Derived(Arg a, const Type& t = Type())
    { }

    Derived f() const
    {
        return Derived(i);
    }

    int i;

};

template class Derived<char>;

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-29  2:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-28 18:06 c++/8389: Cannot access protected member in base class dv

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).