public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14250] New: switch() does not seem to see operator int() in template class
@ 2004-02-23 1:09 savoiu at ics dot uci dot edu
2004-02-23 1:15 ` [Bug c++/14250] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: savoiu at ics dot uci dot edu @ 2004-02-23 1:09 UTC (permalink / raw)
To: gcc-bugs
-- G++ INFO ---------------------------------------------------------------------------------------
Reading specs from /root/gcc/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: ../configure --prefix=/root/gcc --enable-languages=c++
Thread model: posix
gcc version 3.5.0 20040222 (experimental)
-- SOURCE CODE -------------------------------------------------------------------------------
#define USE_TEMPLATE
#ifndef USE_TEMPLATE
#define T unsigned int
#endif// USE_TEMPLATE
#ifdef USE_TEMPLATE
template <typename T>
#endif// USE_TEMPLATE
class O
{
T x;
public:
O(T _x=0)
{
}
O(const O& that)
{
x=that.x;
}
O& operator=(const O& that)
{
x=that.x;
return *this;
}
operator T() const
{
return x;
}
};
#ifdef USE_TEMPLATE
typedef O<unsigned int> MyO;
#else //USE_TEMPLATE
typedef O MyO;
#endif //USE_TEMPLATE
class C1
{
public:
static MyO t1;
class C2
{
public:
static MyO t2;
void fun()
{
switch(t2)
{
default:
break;
}
switch(C1::t1)
{
default:
break;
}
}
};
};
-- BUG INFO ---------------------------------------------------------------------------------------
Given the code above and running just g++ with no command line parameters I get:
[root@home temp]# g++ boog.cpp
boog.cpp: In member function `void C1::C2::fun()':
boog.cpp:53: error: switch quantity not an integer
boog.cpp:59: error: switch quantity not an integer
I expected g++ to see the 'operator T() const'. Note that if you comment out '#define
USE_TEMPLATE' then the code compiles OK.
This problem occurs on other versions of GCC as well (notably 3.3).
Cheers,
Nick
--
Summary: switch() does not seem to see operator int() in template
class
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: savoiu at ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
@ 2004-02-23 1:15 ` pinskia at gcc dot gnu dot org
2004-02-23 2:42 ` giovannibajo at libero dot it
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-23 1:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-23 01:15 -------
Confirmed, a regression from 2.95.3.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |rejects-valid
Known to fail| |3.4.0 3.5.0 3.3.1 3.0.4
Known to work| |2.95.3
Last reconfirmed|0000-00-00 00:00:00 |2004-02-23 01:15:26
date| |
Summary|switch() does not seem to |[3.3/3.4/3.5 Regression]
|see operator int() in |switch() does not seem to
|template class |see operator int() in
| |template class
Target Milestone|--- |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
2004-02-23 1:15 ` [Bug c++/14250] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-23 2:42 ` giovannibajo at libero dot it
2004-02-23 3:59 ` giovannibajo at libero dot it
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-23 2:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-23 02:42 -------
Redux:
----------------------------------------------
template <typename T>
struct A {
operator int();
};
struct C1
{
static A<void> t1;
void fun()
{
switch(t1)
{
default: break;
}
}
};
----------------------------------------------
Trivial fix in testing.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |giovannibajo at libero dot
|dot org |it
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
2004-02-23 1:15 ` [Bug c++/14250] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-23 2:42 ` giovannibajo at libero dot it
@ 2004-02-23 3:59 ` giovannibajo at libero dot it
2004-02-23 12:41 ` cvs-commit at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-23 3:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-23 03:59 -------
Patch posted here:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02080.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (2 preceding siblings ...)
2004-02-23 3:59 ` giovannibajo at libero dot it
@ 2004-02-23 12:41 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:44 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:41 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:40:59
Modified files:
gcc/cp : ChangeLog cvt.c
Log message:
PR c++/14250
* cvt.c (build_expr_type_conversion): Type must be complete before
looking up for conversions.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3966&r2=1.3967
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&r1=1.153&r2=1.154
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (3 preceding siblings ...)
2004-02-23 12:41 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:44 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:46 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:44 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:44:23
Modified files:
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/other: switch1.C
Log message:
PR c++/14250
* g++.dg/other/switch1.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3531&r2=1.3532
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/switch1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (4 preceding siblings ...)
2004-02-23 12:44 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:46 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:48 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:46 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:46:37
Modified files:
gcc/cp : ChangeLog cvt.c
Log message:
PR c++/14250
* cvt.c (build_expr_type_conversion): Type must be complete before
looking up for conversions.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.58&r2=1.3892.2.59
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.151&r2=1.151.4.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (5 preceding siblings ...)
2004-02-23 12:46 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:48 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:50 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:48 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:48:48
Modified files:
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/other: switch1.C
Log message:
PR c++/14250
* g++.dg/other/switch1.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.101&r2=1.3389.2.102
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/switch1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (6 preceding siblings ...)
2004-02-23 12:48 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:50 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:52 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:54 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:50 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:50:50
Modified files:
gcc/cp : ChangeLog cvt.c
Log message:
PR c++/14250
* cvt.c (build_expr_type_conversion): Type must be complete before
looking up for conversions.
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.253&r2=1.3076.2.254
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cvt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.126.2.3&r2=1.126.2.4
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (7 preceding siblings ...)
2004-02-23 12:50 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:52 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:54 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-23 12:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-02-23 12:52 -------
Subject: Bug 14250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: giovannibajo@gcc.gnu.org 2004-02-23 12:52:18
Modified files:
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/other: switch1.C
Log message:
PR c++/14250
* g++.dg/other/switch1.C: New test.
Patches:
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.359&r2=1.2261.2.360
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/switch1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/14250] [3.3/3.4/3.5 Regression] switch() does not seem to see operator int() in template class
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
` (8 preceding siblings ...)
2004-02-23 12:52 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-23 12:54 ` giovannibajo at libero dot it
9 siblings, 0 replies; 11+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-23 12:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-02-23 12:54 -------
Fixed in any new version of GCC starting from GCC 3.3.4. Thanks for your report!
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14250
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-02-23 12:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-23 1:09 [Bug c++/14250] New: switch() does not seem to see operator int() in template class savoiu at ics dot uci dot edu
2004-02-23 1:15 ` [Bug c++/14250] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-23 2:42 ` giovannibajo at libero dot it
2004-02-23 3:59 ` giovannibajo at libero dot it
2004-02-23 12:41 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:44 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:46 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:48 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:50 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:52 ` cvs-commit at gcc dot gnu dot org
2004-02-23 12:54 ` giovannibajo at libero dot it
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).