public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13156] New: Greedy instantiation
@ 2003-11-21 18:40 dave at boost-consulting dot com
2003-11-21 18:50 ` [Bug c++/13156] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dave at boost-consulting dot com @ 2003-11-21 18:40 UTC (permalink / raw)
To: gcc-bugs
The following fails to compile, but shouldn't. You can see this by replacing
the body of X's constructor with ";", which will cause compilation to succeed.
------
struct X
{
template <class T>
X(T const&) { T x = 1; }
};
template <class From, class To>
struct conv
{
static char (& _m_check(...) )[2];
static char _m_check(To);
static From _m_from;
enum {
value = sizeof( _m_check(_m_from) ) == 1
};
};
int x[conv<char*,X>::value ? 1 : -1];
--
Summary: Greedy instantiation
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dave at boost-consulting dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13156
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13156] Greedy instantiation
2003-11-21 18:40 [Bug c++/13156] New: Greedy instantiation dave at boost-consulting dot com
@ 2003-11-21 18:50 ` pinskia at gcc dot gnu dot org
2003-11-21 19:13 ` dave at boost-consulting dot com
2003-11-21 19:42 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-21 18:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-21 18:50 -------
Actually it should fail as:
value = sizeof( _m_check(_m_from) ) == 1
is you cannot use _m_check or _m_from here because the struct is defined as undefined at this
point.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13156
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13156] Greedy instantiation
2003-11-21 18:40 [Bug c++/13156] New: Greedy instantiation dave at boost-consulting dot com
2003-11-21 18:50 ` [Bug c++/13156] " pinskia at gcc dot gnu dot org
@ 2003-11-21 19:13 ` dave at boost-consulting dot com
2003-11-21 19:42 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: dave at boost-consulting dot com @ 2003-11-21 19:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dave at boost-consulting dot com 2003-11-21 19:13 -------
Well, you're wrong about that, but even if you weren't:
------
struct X
{
template <class T>
X(T const&) { T x = 1; }
};
template <class From, class To>
struct conv1
{
static char (& _m_check(...) )[2];
static char _m_check(To);
static From _m_from;
};
template <class From, class To>
struct conv
{
enum {
value = sizeof( conv1<From,To>::_m_check(conv1<From,To>::_m_from) ) ==
1
};
};
int x[conv<char*,X>::value ? 1 : -1];
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13156
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/13156] Greedy instantiation
2003-11-21 18:40 [Bug c++/13156] New: Greedy instantiation dave at boost-consulting dot com
2003-11-21 18:50 ` [Bug c++/13156] " pinskia at gcc dot gnu dot org
2003-11-21 19:13 ` dave at boost-consulting dot com
@ 2003-11-21 19:42 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-21 19:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-21 19:42 -------
That is already fixed on the mainline and since this is not a regression, it will not be back ported
back to 3.3.x.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13156
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-11-21 19:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-21 18:40 [Bug c++/13156] New: Greedy instantiation dave at boost-consulting dot com
2003-11-21 18:50 ` [Bug c++/13156] " pinskia at gcc dot gnu dot org
2003-11-21 19:13 ` dave at boost-consulting dot com
2003-11-21 19:42 ` pinskia 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).