[LLVMbugs] [Bug 13366] Derived instantiation missing type, works in libstdc++, older versions of libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 16 09:17:08 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13366

Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Douglas Gregor <dgregor at apple.com> 2012-07-16 11:17:08 CDT ---
The "reduced" test case isn't really interesting, because it's clearly
ill-formed.

The interesting question here is whether libc++'s vector is allowed to require
that its element type be complete, and (if allowed) whether it should require
that its element type be complete.

C++ [res.on.functions]p2, last bullet, is clear that instantiating a template
component in the library with an incomplete type is undefined behavior, so
libc++ clearly *can* require incomplete types, and the example code is relying
on undefined behavior.

However, historically, C++ standard library implementations have allowed one to
create instances of containers with incomplete types, so arguably libc++
*should* allow this even though it's technically undefined behavior, for the
sake of compatibility. In fact, with top-of-tree Clang, we're back to a state
where this program works, so this has already been fixed on Clang.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list