public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22252] New: pragma interface/implementation still break synthesized methods
@ 2005-06-30 14:55 matz at suse dot de
  2005-06-30 14:57 ` [Bug c++/22252] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: matz at suse dot de @ 2005-06-30 14:55 UTC (permalink / raw)
  To: gcc-bugs

This is similar to bug 21280, but it is _not_ fixed by the patches therein. 
In fact it still happens with current 4.0 branch as of 2005-06-30. 
 
Compile these files: 
 
% cat a.h 
#include <vector> 
#pragma interface 
struct A { 
  std::vector<char> vc; 
}; 
% cat use.cc 
#include "a.h" 
A a; 
int main() {} 
% cat a.cc 
#include <vector> 
#pragma implementation 
#include "a.h" 
 
% g++ -W -Wall -O2 a.cc use.cc  
a.h:3: warning: inline function &#8216;A::A()&#8217; used but never defined 
a.h:3: warning: inline function &#8216;A::~A()&#8217; used but never defined 
/tmp/ccuIwMBN.o: In function `__static_initialization_and_destruction_0(int, 
int)': 
use.cc:(.text+0x31): undefined reference to `A::A()' 
collect2: ld returned 1 exit status 
 
This is because A::A() is not synthesized, although it should happen in file 
a.cc (which contains the pragma implementation). 
 
So, something still is wrong (this actually breaks building lyx btw.) after 
21280 was fixed.

-- 
           Summary: pragma interface/implementation still break synthesized
                    methods
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matz at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org,schwab at suse dot de


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
@ 2005-06-30 14:57 ` pinskia at gcc dot gnu dot org
  2005-06-30 15:01 ` matz at suse dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-30 14:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
            Summary|pragma                      |[4.0/4.1 Regression] pragma
                   |interface/implementation    |interface/implementation
                   |still break synthesized     |still break synthesized
                   |methods                     |methods
   Target Milestone|---                         |4.0.2


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
  2005-06-30 14:57 ` [Bug c++/22252] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-30 15:01 ` matz at suse dot de
  2005-06-30 15:10 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: matz at suse dot de @ 2005-06-30 15:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From matz at suse dot de  2005-06-30 15:01 -------
Andrew: that's not a diagnostic issue.  While the diagnostic (the warning) 
indeed is wrong and misleading (and probably points to the underlying cause 
of this issue), the actual error I'm complaining about is 
the link error, due to not emitting an out-of-line copy of A::A() in a.cc as 
it would be required. 
 

-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
  2005-06-30 14:57 ` [Bug c++/22252] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-06-30 15:01 ` matz at suse dot de
@ 2005-06-30 15:10 ` pinskia at gcc dot gnu dot org
  2005-06-30 15:24 ` matz at suse dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-30 15:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-30 15:10 -------
(In reply to comment #1)
Yes which is why I did not confirm it yet because I did not look at fully.  I just added the diagnostic 
keyword because it is still a wrong warning.  I am adding wrong-code also.
Reduced testcase:
---- a.ii ----
# 1 "a.cc"
# 0 "<built-in>"
# 1 "<command line>"
# 1 "a.cc"
#pragma implementation
# 1 "a.h" 1
struct B
{
  B(){};
  ~B(){}
};
#pragma interface
struct A {
  B a;

};
# 3 "a.cc" 2

---- use.ii ----
# 1 "use.cc"
# 0 "<built-in>"
# 1 "<command line>"
# 1 "use.cc"
# 1 "a.h" 1
struct B
{
  B(){};
  ~B(){}
};
#pragma interface
struct A {
  B a;

};
# 2 "use.cc" 2
A a;
int main() {}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-30 15:10:43
               date|                            |


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
                   ` (2 preceding siblings ...)
  2005-06-30 15:10 ` pinskia at gcc dot gnu dot org
@ 2005-06-30 15:24 ` matz at suse dot de
  2005-09-07  0:11 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: matz at suse dot de @ 2005-06-30 15:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From matz at suse dot de  2005-06-30 15:23 -------
Ah, I see.  Note that you must compile the reduced testcase (thanks for 
that) with -O0, or with -fno-inline, otherwise the A::A ctor will be inlined 
in use.cc (making the warning about the non-availability of it even more 
funny ;-) ), and not lead to the link error. 

-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
                   ` (3 preceding siblings ...)
  2005-06-30 15:24 ` matz at suse dot de
@ 2005-09-07  0:11 ` mmitchel at gcc dot gnu dot org
  2005-09-09 16:34 ` [Bug c++/22252] [4.0 " mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-07  0:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
                   ` (4 preceding siblings ...)
  2005-09-07  0:11 ` mmitchel at gcc dot gnu dot org
@ 2005-09-09 16:34 ` mmitchel at gcc dot gnu dot org
  2005-09-09 18:56 ` cvs-commit at gcc dot gnu dot org
  2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-09 16:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-09-09 16:33 -------
Fixed in 4.1.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1 Regression] pragma |[4.0 Regression] pragma
                   |interface/implementation    |interface/implementation
                   |still break synthesized     |still break synthesized
                   |methods                     |methods


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
                   ` (5 preceding siblings ...)
  2005-09-09 16:34 ` [Bug c++/22252] [4.0 " mmitchel at gcc dot gnu dot org
@ 2005-09-09 18:56 ` cvs-commit at gcc dot gnu dot org
  2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-09 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-09-09 18:56 -------
Subject: Bug 22252

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-09-09 18:56:16

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog decl.c decl2.c pt.c semantics.c 
Added files:
	gcc/testsuite/g++.dg/ext: interface1.C interface1.h 
	                          interface1a.cc 

Log message:
	PR c++/22252
	* decl.c (start_preparsed_function): Do not pay attention to
	#pragma interface for implicitly-defined methods.
	* decl2.c (cp_finish_file): Do not complain about uses of inline
	functions that have bodies, even if we decided not to emit the
	body in this translation unit.
	* semantics.c (note_decl_for_pch): Do not mess with linkage.
	(expand_or_defer_fn): Make inline, non-template functions COMDAT
	at this point.
	
	PR c++/22252
	* g++.dg/ext/interface1.C: New test.
	* g++.dg/ext/interface1.h: Likewise.
	* g++.dg/ext/interface1a.cc: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6041&r2=1.6042
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4880&r2=1.4881
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1424&r2=1.1425
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.799&r2=1.800
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1029&r2=1.1030
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.487&r2=1.488
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1.h.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1a.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0 Regression] pragma interface/implementation still break synthesized methods
  2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
                   ` (6 preceding siblings ...)
  2005-09-09 18:56 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  7 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:21 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/22252] [4.0/4.1 Regression] pragma interface/implementation still break synthesized methods
       [not found] <bug-22252-183@http.gcc.gnu.org/bugzilla/>
@ 2006-01-15 22:43 ` mmitchel at gcc dot gnu dot org
  0 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-01-15 22:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mmitchel at gcc dot gnu dot org  2006-01-15 22:43 -------
The claim in Comment #9 is that this is a 4.1 regression as well as a 4.0
regression, so I've udpated the subject line.  It would be interesting to know
if this affects mainline as well.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0 Regression] pragma     |[4.0/4.1 Regression] pragma
                   |interface/implementation    |interface/implementation
                   |still break synthesized     |still break synthesized
                   |methods                     |methods


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-01-15 22:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-30 14:55 [Bug c++/22252] New: pragma interface/implementation still break synthesized methods matz at suse dot de
2005-06-30 14:57 ` [Bug c++/22252] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-06-30 15:01 ` matz at suse dot de
2005-06-30 15:10 ` pinskia at gcc dot gnu dot org
2005-06-30 15:24 ` matz at suse dot de
2005-09-07  0:11 ` mmitchel at gcc dot gnu dot org
2005-09-09 16:34 ` [Bug c++/22252] [4.0 " mmitchel at gcc dot gnu dot org
2005-09-09 18:56 ` cvs-commit at gcc dot gnu dot org
2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-22252-183@http.gcc.gnu.org/bugzilla/>
2006-01-15 22:43 ` [Bug c++/22252] [4.0/4.1 " mmitchel at gcc dot gnu dot org

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).