public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13323] New: Template code does not compile in presence of typedef
@ 2003-12-05 21:01 david dot lee at teracruz dot com
  2003-12-05 21:12 ` [Bug c++/13323] [3.3/3.4 regression] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: david dot lee at teracruz dot com @ 2003-12-05 21:01 UTC (permalink / raw)
  To: gcc-bugs

The following code compiles fine with gcc 3.2.  However, with 3.3.2, I get an 
error.

[dlee@d100-devel cpp]$ cat > bug.cpp <<EOF
typedef int INT_TYPEDEF;

template<class T>
class TypedIfc
{
public:
  virtual ~TypedIfc() { }
  virtual operator const T&() const = 0;
  virtual const T& operator= (const T& t) = 0;
};

template<class Tnative>
class NullIfc : public TypedIfc<Tnative>
{
public:
  const Tnative& operator= (const Tnative& t) { return t; }
  operator const Tnative&() const { return *(Tnative *)0; }
};

#ifndef DONTBREAK // -DDONTBREAK to get a build that works.
typedef TypedIfc<INT_TYPEDEF> INT_TYPEDEFIfc;
#endif

NullIfc<int> i32;
EOF

[dlee@d100-devel cpp]$ i686-linux-g++ bug.cpp -o /dev/null -c -DDONTBREAK
[dlee@d100-devel cpp]$ i686-linux-g++ bug.cpp -o /dev/null -c
bug.cpp:24: error: cannot declare variable `i32' to be of type `NullIfc<int>'
bug.cpp:24: error:   because the following virtual functions are abstract:
bug.cpp:8: error:       TypedIfc<T>::operator const T&() const [with T = 
   INT_TYPEDEF]

Here's the info for my compiler:

[dlee@d100-devel cpp]$ i686-linux-g++ --verbose
Reading specs from /tools/i386/lib/gcc-lib/i686-linux/3.3.2/specs
Configured with: /src/gcc-3.3.2/configure --target=i686-linux --host=i686-
host_pc-linux-gnu --prefix=/tools/i386 --with-headers=/tools/i386/i686-
linux/include --disable-nls --enable-symvers=gnu --enable-threads=posix --
enable-__cxa_atexit --enable-languages=c,c++ --enable-clocale=gnu --with-local-
prefix=/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/i386/i686-
linux --disable-multilib
Thread model: posix
gcc version 3.3.2

-- 
           Summary: Template code does not compile in presence of typedef
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david dot lee at teracruz dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
@ 2003-12-05 21:12 ` bangerth at dealii dot org
  2003-12-06  2:46 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-12-05 21:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-12-05 21:12 -------
This is clearly a bug, and a regression on 3.3/mainline w.r.t. 3.2.x. 
 
Here's an extract: 
------------------------- 
template <class T> struct B { 
  virtual operator T() const = 0; 
}; 
 
template <class T> 
struct D : B<T> { 
  virtual operator T() const; 
}; 
 
typedef int i; 
typedef B<i> Bi; 
 
D<int> i32; 
--------------------------- 
 
g/x> /home/bangerth/bin/gcc-3.2.3/bin/c++ -c x.cc 
g/x> /home/bangerth/bin/gcc-3.3.3-pre/bin/c++ -c x.cc 
x.cc:13: error: cannot declare variable `i32' to be of type `D<int>' 
x.cc:13: error:   because the following virtual functions are abstract: 
x.cc:2: error:  B<T>::operator T() const [with T = i] 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-05 21:12:51
               date|                            |
            Summary|Template code does not      |[3.3/3.4 regression]
                   |compile in presence of      |Template code does not
                   |typedef                     |compile in presence of
                   |                            |typedef
   Target Milestone|---                         |3.3.3


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
  2003-12-05 21:12 ` [Bug c++/13323] [3.3/3.4 regression] " bangerth at dealii dot org
@ 2003-12-06  2:46 ` pinskia at gcc dot gnu dot org
  2003-12-06 22:11 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-06  2:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-06 02:46 -------
>From Phil's regression hunter: Search converges between 2003-06-17-trunk (#316) and 2003-06
-18-trunk (#317).
: Search converges between 2003-06-14-3.3 (#145) and 2003-06-22-3.3 (#146).

Related to bug 11928 and PR 11713 (the ones caused also in the same time period, both of them 
the same patch).
So it is most likely the same patch:
2003-06-17  Mark Mitchell  <mark@codesourcery.com>

      PR c++/11105
      * cp-tree.h (DECL_CONV_FN_TYPE): New method.
      * decl.c (lookup_name_real): Backport conversion operator code
      from mainline.
      * mangle.c (struct globals): Remove internal_mangling_p.
      (write_unqualified_name): Use DECL_CONV_FN_TYPE.
      (write_template_parm): Don't write out the level number.
      (conv_type_names): New variable.
      (hash_type): New function.
      (compare_type): Likewise.
      (mangle_conv_op_name_for_type): Don't try to mangle conversion
      operator names.
      * search.c (lookup_conversion_operator): New function.
      (lookup_fnfields_1): Use it.

Mark could you look at this one?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
  2003-12-05 21:12 ` [Bug c++/13323] [3.3/3.4 regression] " bangerth at dealii dot org
  2003-12-06  2:46 ` pinskia at gcc dot gnu dot org
@ 2003-12-06 22:11 ` cvs-commit at gcc dot gnu dot org
  2003-12-06 22:19 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-06 22:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-06 22:11 -------
Subject: Bug 13323

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-12-06 22:11:46

Modified files:
	gcc/cp         : ChangeLog class.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/inherit: operator2.C 

Log message:
	PR c++/13323
	* class.c (same_signature_p): Handle conversion operators
	correctly.
	(check_for_override): Likewise.
	
	PR c++/13323
	* g++.dg/inherit/operator2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3785&r2=1.3786
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.583&r2=1.584
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3234&r2=1.3235
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/operator2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
                   ` (2 preceding siblings ...)
  2003-12-06 22:11 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-06 22:19 ` cvs-commit at gcc dot gnu dot org
  2003-12-06 22:20 ` mmitchel at gcc dot gnu dot org
  2003-12-08 22:17 ` david dot lee at teracruz dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-06 22:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-06 22:19 -------
Subject: Bug 13323

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	mmitchel@gcc.gnu.org	2003-12-06 22:19:31

Modified files:
	gcc/cp         : ChangeLog class.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/inherit: operator2.C 

Log message:
	PR c++/13323
	* class.c (same_signature_p): Handle conversion operators
	correctly.
	(check_for_override): Likewise.
	
	PR c++/13323
	* g++.dg/inherit/operator2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.221&r2=1.3076.2.222
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.24&r2=1.499.2.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.324&r2=1.2261.2.325
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/operator2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
                   ` (3 preceding siblings ...)
  2003-12-06 22:19 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-06 22:20 ` mmitchel at gcc dot gnu dot org
  2003-12-08 22:17 ` david dot lee at teracruz dot com
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-12-06 22:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-12-06 22:20 -------
Fixed in GCC 3.3.3 and GCC 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/13323] [3.3/3.4 regression] Template code does not compile in presence of typedef
  2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
                   ` (4 preceding siblings ...)
  2003-12-06 22:20 ` mmitchel at gcc dot gnu dot org
@ 2003-12-08 22:17 ` david dot lee at teracruz dot com
  5 siblings, 0 replies; 7+ messages in thread
From: david dot lee at teracruz dot com @ 2003-12-08 22:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From david dot lee at teracruz dot com  2003-12-08 22:17 -------
Thanks for the prompt response!  This fix gets me going again :-)

-- 


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


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

end of thread, other threads:[~2003-12-08 22:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-05 21:01 [Bug c++/13323] New: Template code does not compile in presence of typedef david dot lee at teracruz dot com
2003-12-05 21:12 ` [Bug c++/13323] [3.3/3.4 regression] " bangerth at dealii dot org
2003-12-06  2:46 ` pinskia at gcc dot gnu dot org
2003-12-06 22:11 ` cvs-commit at gcc dot gnu dot org
2003-12-06 22:19 ` cvs-commit at gcc dot gnu dot org
2003-12-06 22:20 ` mmitchel at gcc dot gnu dot org
2003-12-08 22:17 ` david dot lee at teracruz dot com

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