public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors
@ 2011-05-27 18:41 aaw at gcc dot gnu.org
2011-05-27 19:12 ` [Bug c++/49198] [4.5/4.6/4.7 Regression] GCC generates " paolo.carlini at oracle dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: aaw at gcc dot gnu.org @ 2011-05-27 18:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49198
Summary: GCC trunk and 4.6 generate spurious "has incomplete
type" errors
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: aaw@gcc.gnu.org
Created attachment 24376
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24376
Minimal reproduction
See the attached tst.cc file. When compiled with GCC trunk and 4.6, it
generates the following errors:
tst.cc: In instantiation of ‘S<IC>’:
tst.cc:14:7: instantiated from here
tst.cc:3:32: error: ‘S<T>::t’ has incomplete type
tst.cc:1:7: error: forward declaration of ‘struct IC’
However, the code is structured such that IC need not be complete. According
to the C++ standard (14.7.1):
"Unless a class template specialization has been explicitly instantiated
(14.7.2) or explicitly specialized (14.7.3), the class template specialization
is implicitly instantiated when the specialization is referenced in a context
that requires a completely-defined object type or when the completeness of the
class type affects the semantics of the program."
In this case, we only refer to S<IC>* (pointer), which does not require a
complete type. Therefore, the class template specialization S<IC> should not
be instantiated, and IC need not be complete.
Various trivial modifications to this program (e.g. replacing S<IC>* with IC*
or replacing FT(F) with F) do not generate an error. Nor does GCC 4.4.3.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/49198] [4.5/4.6/4.7 Regression] GCC generates spurious "has incomplete type" errors
2011-05-27 18:41 [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors aaw at gcc dot gnu.org
@ 2011-05-27 19:12 ` paolo.carlini at oracle dot com
2011-05-27 21:16 ` [Bug c++/49198] " jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-27 19:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49198
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.05.27 19:06:43
CC| |jason at gcc dot gnu.org
Known to work| |4.4.6
Summary|GCC trunk and 4.6 generate |[4.5/4.6/4.7 Regression]
|spurious "has incomplete |GCC generates spurious "has
|type" errors |incomplete type" errors
Ever Confirmed|0 |1
Known to fail| |4.6.1, 4.7.0
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-27 19:06:43 UTC ---
Let's ask Jason to have a look. To be safe I'm marking this as Regression.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/49198] GCC generates spurious "has incomplete type" errors
2011-05-27 18:41 [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors aaw at gcc dot gnu.org
2011-05-27 19:12 ` [Bug c++/49198] [4.5/4.6/4.7 Regression] GCC generates " paolo.carlini at oracle dot com
@ 2011-05-27 21:16 ` jason at gcc dot gnu.org
2011-05-27 21:29 ` paolo.carlini at oracle dot com
2011-05-31 18:26 ` aaw at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 21:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49198
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
Summary|[4.5/4.6/4.7 Regression] |GCC generates spurious "has
|GCC generates spurious "has |incomplete type" errors
|incomplete type" errors |
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 21:05:25 UTC ---
The instantiation is being triggered by argument-dependent lookup. When we see
FT(F), the associated classes for the argument F are the associated classes for
S<IC>*, or S<IC>, so we instantiate S<IC> to get any friend declarations.
If you change the call to ::FT(F), no argument-dependent lookup is done, so the
instantiation is not triggered.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/49198] GCC generates spurious "has incomplete type" errors
2011-05-27 18:41 [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors aaw at gcc dot gnu.org
2011-05-27 19:12 ` [Bug c++/49198] [4.5/4.6/4.7 Regression] GCC generates " paolo.carlini at oracle dot com
2011-05-27 21:16 ` [Bug c++/49198] " jason at gcc dot gnu.org
@ 2011-05-27 21:29 ` paolo.carlini at oracle dot com
2011-05-31 18:26 ` aaw at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-27 21:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49198
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-27 21:15:31 UTC ---
Thanks for the clarification. Indeed, Comeau online rejects it, current ICC,
even in strict-ansi mode, doesn't however (also using EDG, AFAIK), weird.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/49198] GCC generates spurious "has incomplete type" errors
2011-05-27 18:41 [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors aaw at gcc dot gnu.org
` (2 preceding siblings ...)
2011-05-27 21:29 ` paolo.carlini at oracle dot com
@ 2011-05-31 18:26 ` aaw at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: aaw at gcc dot gnu.org @ 2011-05-31 18:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49198
--- Comment #4 from Ollie Wild <aaw at gcc dot gnu.org> 2011-05-31 18:13:02 UTC ---
Thanks for the clarification, Jason.
I would not have figured that out on my own.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-31 18:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 18:41 [Bug c++/49198] New: GCC trunk and 4.6 generate spurious "has incomplete type" errors aaw at gcc dot gnu.org
2011-05-27 19:12 ` [Bug c++/49198] [4.5/4.6/4.7 Regression] GCC generates " paolo.carlini at oracle dot com
2011-05-27 21:16 ` [Bug c++/49198] " jason at gcc dot gnu.org
2011-05-27 21:29 ` paolo.carlini at oracle dot com
2011-05-31 18:26 ` aaw at gcc dot gnu.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).