public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type
@ 2004-07-19 19:45 geoffk at gcc dot gnu dot org
2004-07-19 20:23 ` [Bug c++/16635] " bangerth at dealii dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-07-19 19:45 UTC (permalink / raw)
To: gcc-bugs
Consider the following:
template <class T> T * foo (T * x)
{
return x++;
}
struct aclass;
aclass *
addone (aclass * x)
{
return foo<aclass>(x);
}
struct aclass
{
int x;
};
At the point where foo<aclass> is instantiated, 'aclass' is incomplete, and 'x++' requires it to be
complete, so this program is not well-formed, and a diagnostic is required.
--
Summary: g++ doesn't diagnose instantiation of template that uses
incomplete type
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: geoffk at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: powerpc-apple-darwin7.3
GCC target triplet: powerpc-apple-darwin7.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/16635] g++ doesn't diagnose instantiation of template that uses incomplete type
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
@ 2004-07-19 20:23 ` bangerth at dealii dot org
2004-07-31 0:25 ` giovannibajo at libero dot it
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-07-19 20:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-07-19 20:23 -------
Confirmed. I'm sure Giovanni has something to say about this.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |giovannibajo at gcc dot gnu
| |dot org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-07-19 20:23:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/16635] g++ doesn't diagnose instantiation of template that uses incomplete type
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
2004-07-19 20:23 ` [Bug c++/16635] " bangerth at dealii dot org
@ 2004-07-31 0:25 ` giovannibajo at libero dot it
2005-04-26 6:54 ` [Bug c++/16635] g++ instantiates templates at the wrong place geoffk at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: giovannibajo at libero dot it @ 2004-07-31 0:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-07-31 00:25 -------
I am not 100% sure about this. Geoff, why do you think GCC is wrong? FWIW EDG
does exactly the same. Do you have a specific quote from the standard?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/16635] g++ instantiates templates at the wrong place
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
2004-07-19 20:23 ` [Bug c++/16635] " bangerth at dealii dot org
2004-07-31 0:25 ` giovannibajo at libero dot it
@ 2005-04-26 6:54 ` geoffk at gcc dot gnu dot org
2005-06-23 1:20 ` pinskia at gcc dot gnu dot org
2005-06-23 1:28 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2005-04-26 6:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From geoffk at gcc dot gnu dot org 2005-04-26 06:53 -------
Here's the same thing with overloaded functions, causing a wrong-code error. If the last definition of
'bar' is commented out, the testcase passes, but otherwise not.
template <class T> int func(T & x)
{
return bar (x);
}
int bar(const int & x)
{
return x;
}
extern "C" void abort ();
int main (void)
{
int x = 3;
if (func<int>(x) != 3)
abort ();
}
int bar (int &x)
{
return x + 3;
}
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Known to fail| |3.3 4.0.0
Summary|g++ doesn't diagnose |g++ instantiates templates
|instantiation of template |at the wrong place
|that uses incomplete type |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/16635] g++ instantiates templates at the wrong place
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-04-26 6:54 ` [Bug c++/16635] g++ instantiates templates at the wrong place geoffk at gcc dot gnu dot org
@ 2005-06-23 1:20 ` pinskia at gcc dot gnu dot org
2005-06-23 1:28 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-23 1:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-23 01:19 -------
(In reply to comment #5)
> Here's the same thing with overloaded functions, causing a wrong-code error. If the last definition of
> 'bar' is commented out, the testcase passes, but otherwise not.
That code is acutally invalid and really should have been rejected see PR 2922 for that.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords|wrong-code |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/16635] g++ instantiates templates at the wrong place
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-06-23 1:20 ` pinskia at gcc dot gnu dot org
@ 2005-06-23 1:28 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-23 1:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-23 01:27 -------
(In reply to comment #6)
> (In reply to comment #5)
> > Here's the same thing with overloaded functions, causing a wrong-code error. If the last definition
of
> > 'bar' is commented out, the testcase passes, but otherwise not.
> That code is acutally invalid and really should have been rejected see PR 2922 for that.
Also if we move the template func after bar and main after the second bar, we get back to basicially PR
2922. So the first testcase is the only one which the problem for this bug.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16635
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-23 1:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-19 19:45 [Bug c++/16635] New: g++ doesn't diagnose instantiation of template that uses incomplete type geoffk at gcc dot gnu dot org
2004-07-19 20:23 ` [Bug c++/16635] " bangerth at dealii dot org
2004-07-31 0:25 ` giovannibajo at libero dot it
2005-04-26 6:54 ` [Bug c++/16635] g++ instantiates templates at the wrong place geoffk at gcc dot gnu dot org
2005-06-23 1:20 ` pinskia at gcc dot gnu dot org
2005-06-23 1:28 ` 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).