From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25088 invoked by alias); 15 Mar 2003 16:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 25040 invoked by uid 71); 15 Mar 2003 16:56:01 -0000 Date: Sat, 15 Mar 2003 16:56:00 -0000 Message-ID: <20030315165601.25038.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Chris Kappler" Subject: Re: c++/10086: static const int unresolved in ? : construct Reply-To: "Chris Kappler" X-SW-Source: 2003-03/txt/msg00994.txt.bz2 List-Id: The following reply was made to PR c++/10086; it has been noted by GNATS. From: "Chris Kappler" To: , , , , , Cc: Subject: Re: c++/10086: static const int unresolved in ? : construct Date: Sat, 15 Mar 2003 11:55:43 -0500 This is a multi-part message in MIME format. ------=_NextPart_000_0004_01C2EAE9.CED59AA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I do not agree. In the attachment to this email, the commented code compiles perfectly. The uncommented code results in a linker error. I believe that the two pieces of code are semantically equivalent. ----- Original Message ----- From: To: ; ; ; Sent: Friday, March 14, 2003 5:33 PM Subject: Re: c++/10086: static const int unresolved in ? : construct > Synopsis: static const int unresolved in ? : construct > > State-Changed-From-To: open->closed > State-Changed-By: bangerth > State-Changed-When: Fri Mar 14 22:33:31 2003 > State-Changed-Why: > Not a bug. You need a definition of the variable. > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p r=10086 ------=_NextPart_000_0004_01C2EAE9.CED59AA0 Content-Type: application/octet-stream; name="bug.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="bug.cpp" =0A= #include =0A= using namespace std;=0A= =0A= class Base {=0A= public:=0A= const static int A =3D 0;=0A= const static int B =3D 1;=0A= };=0A= =0A= class Child : public Base {=0A= public:=0A= void printAB(bool v);=0A= };=0A= =0A= =0A= void Child::printAB(bool v) {=0A= int aa =3D A;=0A= int bb =3D B;=0A= int a =3D (v)?A:B; // causes a linker error=0A= int b =3D (!v)?A:B; // causes a linker error=0A= //int a =3D (v)?aa:bb; // compiles and runs if uncommented=0A= //int b =3D (!v)?aa:bb; // compiles and runs if uncommented=0A= =0A= cout<<"a is "<