public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Tringi at Mx-3 dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/18512] New: ICE on overriden template method
Date: Tue, 16 Nov 2004 02:13:00 -0000	[thread overview]
Message-ID: <20041116021313.18512.Tringi@Mx-3.cz> (raw)

Hello,

I was just wondering around code and following code resulted in ICE (MinGW 
3.4.2). I don't think that this is some kind of terrible bug as the code is 
obviously wrong (or isn't it?). Maybe you'll want to know about it, at least 
the compiler want me to report bug :) Maybe someone already reported 
it ...unfortunately have no time to browse buglists... :(

The error message is:

g++.exe -c main.cpp -o main.o -I"C:/Code/Dev-Cpp/include"  

-I"C:/Code/Dev-Cpp/include/c++/3.4.2"  

-I"C:/Code/Dev-Cpp/include/c++/3.4.2/backward"  

-I"C:/Code/Dev-Cpp/include/c++/3.4.2/mingw32"  

-I"C:/Code/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -save-temps -Wall  
main.cpp: In member function `virtual const int iii::get_callback() const':
main.cpp:13: internal compiler error: in lookup_member, at cp/search.c:1288
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.make.exe: *** 
[main.o] Error 1

Yes I know it says to contact MinGW but I think the ICEs are better to submit 
to GCC directly, aren't they?

The codes are:

--- main.cpp ---
#include <stdlib.h>
#include <stdio.h>
#include "cProperty.tcc"

class iii : public property<int> {
    public:
        iii() { };
        iii(int i) : property<int>(i) { };
    
    protected:
        const int get_callback() const {
            printf("my getcb\n");
            return this->property<int>; // this causes the ICE
        };
    
};

int main(int argc, char *argv[]) {
    iii *i = new iii;
    
    printf("::: %d\n", (int)*i );
    *i = 1;
    printf("::: %d\n", (int)*i );
    
    delete i;
    
    system("PAUSE");	
    return 0;
};

--- EOF ---
--- cProperty.tcc ---
#ifndef CPROPERTY_HPP
#define CPROPERTY_HPP

template <typename T> class property {
    private:
        T _p;
        
    protected:
        virtual const T get_callback() const { printf("getcb\n"); return _p; };
        virtual const T set_callback(const T& p) const { printf("setcb\n"); 
return 

p; };
        
    public:
        property() { };
        property(const T &p) { this->_p = set_callback(p); };
        virtual ~property() { };
        
        virtual operator T() const { return get_callback(); };
        virtual const T& operator=(const T &p) { return this->_p = set_callback
(p); 

};
        
};

#endif

--- EOF ---

Well, there is a lot of code that could be stripped but I hope you can browse 

through it.
Have a good time.

-- 
           Summary: ICE on overriden template method
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Tringi at Mx-3 dot cz
                CC: gcc-bugs at gcc dot gnu dot org


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


             reply	other threads:[~2004-11-16  2:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16  2:13 Tringi at Mx-3 dot cz [this message]
2004-11-16  2:21 ` [Bug c++/18512] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-16  2:35 ` [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class reichelt at gcc dot gnu dot org
2004-11-27 17:29 ` mmitchel at gcc dot gnu dot org
2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
2004-11-29 20:25 ` [Bug c++/18512] [3.4 " mmitchel at gcc dot gnu dot org
2005-04-22  4:13 ` pinskia at gcc dot gnu dot org
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
2005-09-01 14:58 ` reichelt at gcc dot gnu dot org
2005-09-01 15:23 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:24 ` reichelt at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041116021313.18512.Tringi@Mx-3.cz \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).