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

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