delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/15/09:30:49

Xref: news2.mv.net comp.os.msdos.djgpp:7300
Newsgroups: comp.os.msdos.djgpp
Subject: Internal compiler error 308.
Message-ID: <01bb8a30$ed69ae50$e62e4cc3@roco>
From: "Paco Ferre" <pferre AT caronte DOT adi DOT uam DOT es>
Date: 14 Aug 1996 22:35:23 GMT
Organization: Universidad Autonoma de Madrid
NNTP-Posting-Host: ppp2230.lander.es
Mime-Version: 1.0
Lines: 51
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a simple program which causes two kind of errors.

You will see what i am trying to do:

--------------------------------- from
#include <stdio.h>

typedef char *(*getfuncptr)(int);

class aClass {
public:
        char* Func(int pos);
};

void (aClass::*pmfnFunc)() = &aClass::Func;

char* aClass::Func(int pos)
{
        static char *list[] = { "\nFirst", "\nSecond" };

        return list[pos];
}

int Second(void *f)
{
	puts((*(getfuncptr)f)(1));
}

void main(void)
{
	class aClass MiClass;

//        This causes a General Protection fault, without errors reported
by the compiler.
//        This was the first thing i tried. I don't know if this is the
good manner.
        Second((void*) &aClass::Func);

//        And this causes an Internal Compiler Error 308
        Second((void*) (MiClass.*pmfnFunc));
}
--------------------------------- to

Thanks for any idea.

---------------------------------
Paco Ferre
Universidad Autonoma de Madrid (Spain)
mailto:pferre AT strogoff DOT adi DOT uam DOT es
---------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019