[llvm-bugs] [Bug 42303] New: Default parameter of unique_ptr instantiates causing failure with incomplete type:
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 17 15:09:57 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42303
Bug ID: 42303
Summary: Default parameter of unique_ptr instantiates causing
failure with incomplete type:
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: erich.keane at intel.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
#include <memory>
struct Base;
class Class {
Class ( std::unique_ptr<Base>&& combat_targets = nullptr);
};
The above reproducer results in:
bash-4.2$ ../../llvm-project/build/bin/clang++ --version
clang version 9.0.0 (/iusers/ekeane1/workspaces/llvm-project/clang
689509edab4d073ec3bca7d433808ae48a6cddd8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/export/iusers/ekeane1/workspaces/xmain/repro/../../llvm-project/build/bin
bash-4.2$ ../../llvm-project/build/bin/clang++ test.cpp
In file included from test.icx.cpp:1:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/memory:81:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/unique_ptr.h:65:16:
error: invalid application of 'sizeof' to an incomplete type 'Base'
static_assert(sizeof(_Tp)>0,
^~~~~~~~~~~
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/unique_ptr.h:184:4:
note: in instantiation of member function
'std::default_delete<Base>::operator()' requested here
get_deleter()(__ptr);
^
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/unique_ptr.h:157:50:
note: in instantiation of member function 'std::unique_ptr<Base,
std::default_delete<Base> >::~unique_ptr' requested here
constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { }
^
test.icx.cpp:3:12: note: forward declaration of 'Base'
This appears to be a regression, as current godbolt (r363523) doesn't seem to
repro the issue. https://godbolt.org/z/Z_2tlY
We seem to be instantiating the default parameter before the function is used,
so this no longer works (it does in GCC as well). Is this intentional?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190617/97ae510a/attachment.html>
More information about the llvm-bugs
mailing list