delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/23/14:00:42

From: "Elias Pschernig" <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: g++ class member initialization bug?
Date: Sat, 23 May 1998 19:20:21 +0200
Organization: magnet Internet Services
Lines: 27
Message-ID: <6k7196$jfp$1@orudios.magnet.at>
References: <6k63ce$4t9$3 AT simtel DOT ru>
NNTP-Posting-Host: 195.3.67.188
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Aleksey Kondratyev schrieb in Nachricht <6k63ce$4t9$3 AT simtel DOT ru>...
>Replying one message from comp.lang.c++ I discovered a strange
>DJGPP behavior. IMHO C++ standard forbids the construction below.
>
>class base
>>{
>>protected:
>>      const int nn[]={10,20};
>
>A C++ class members can be initialized by the use of a constructor only.
>The author of an original message <6k5lsf$40i$1 AT news DOT iastate DOT edu>
>in comp.lang.c++ claimed that g++ 2.8.0 compiles such things fine
>but abandons to link saying that 'nn' is unresolved.
>I tried DJGPP 2.8.0 and it did the same. Is it a bug?
>
g++ (version 2.7) gives you this warning:
Warning:  ANSI C++ forbids initialization of member `nn'
it compiles AND links fine, however.
the error in the linker is because of the "const" keyword...

i think this isn't a bug, because the warning tells you that
you're doing something not ANSI-compliant...

Elias Pschernig


- Raw text -


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