public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28464]  New: template inheritance loses base class scope
@ 2006-07-23 21:41 tim at deadlyninja dot com
  2006-07-23 23:59 ` [Bug c++/28464] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: tim at deadlyninja dot com @ 2006-07-23 21:41 UTC (permalink / raw)
  To: gcc-bugs

#include <stdio.h>

template <typename TYPE>
struct Base {
        Base() {
                //this unqualified call works fine within the base class
                voidFunc();
        }

        void voidFunc() {
                printf("voidFunc()!\n");
        }

        //a public variable
        TYPE m_publicVar;
};

template <typename TYPE>
struct Child : public Base<TYPE> {
        Child() {
                //calling fully qualified works fine
                Base<TYPE>::voidFunc();

                //this spits out 
                //"error: there are no arguments to `voidFunc' that depend on a
template parameter, so a declaration of `voidFunc' must be available
                //        (if you use `-fpermissive', G++ will accept your
code, but allowing the use of an undeclared name is deprecated)"
                //and will compile and link with -fpermissive
                voidFunc();

                if (m_publicVar) { //this var access will not compile regardles
of -fpermissive
                        printf("m_publicVar!\n");
                }
        }

};

int main(int argc, const char* argv) {
        Child<int> child;
        return 0;
}


-- 
           Summary: template inheritance loses base class scope
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at deadlyninja dot com
  GCC host triplet: i686-pc-linux-gnu-3.4.6
GCC target triplet: i686-pc-linux-gnu-3.4.6


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28464


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/28464] template inheritance loses base class scope
  2006-07-23 21:41 [Bug c++/28464] New: template inheritance loses base class scope tim at deadlyninja dot com
@ 2006-07-23 23:59 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-23 23:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-07-23 23:59 -------
The Error is correct.
See http://gcc.gnu.org/gcc-3.4/changes.html
.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28464


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-23 23:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-23 21:41 [Bug c++/28464] New: template inheritance loses base class scope tim at deadlyninja dot com
2006-07-23 23:59 ` [Bug c++/28464] " 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).