Bug 17816

Summary: duplicate definition of pure virtual function not diagnosed
Product: gcc Reporter: Richard Henderson <rth>
Component: c++Assignee: Alexandre Oliva <aoliva>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, reichelt
Priority: P2 Keywords: accepts-invalid, monitored, patch
Version: 4.0.0   
Target Milestone: 4.0.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-02-09 13:06:51

Description Richard Henderson 2004-10-03 19:44:28 UTC
struct S {
  virtual int foo() = 0;
};
 
int S::foo() { return 0; }
int S::foo() { return 0; }

Affects at least gcc 3.2 and forward.
Comment 1 Andrew Pinski 2004-10-03 19:46:36 UTC
Confirmed.
Comment 2 Volker Reichelt 2005-01-20 23:52:31 UTC
Fails since at least gcc 2.95.3.
Comment 3 Andrew Pinski 2005-02-09 14:36:41 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg00351.html>.
Comment 4 GCC Commits 2005-02-14 12:01:29 UTC
Subject: Bug 17816

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aoliva@gcc.gnu.org	2005-02-14 12:01:16

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/other: redecl2.C 

Log message:
	gcc/cp/ChangeLog:
	PR c++/17816
	* decl.c (redeclaration_error_message): Report redefinition of
	pure virtual function.
	gcc/testsuite/ChangeLog:
	PR c++/17816
	* g++.dg/other/redecl2.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4626&r2=1.4627
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1362&r2=1.1363
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5029&r2=1.5030
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/redecl2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 Andrew Pinski 2005-02-14 15:00:30 UTC
Fixed.