https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87660

            Bug ID: 87660
           Summary: Fail to compile unique_ptr of incomplete tyoe
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tiagomacarios at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/zvJQ4F

For the following code GCC will fail to compile the {} and the nullptr
initializes.

#include <memory>

struct foo;

struct bar
{
    #if defined(DEFAULT)
        std::unique_ptr<foo> m_;
    #elif defined(UNIFORM)
        std::unique_ptr<foo> m_{};
    #else
        std::unique_ptr<foo> m_ = nullptr;
    #endif
};

I would think this is a bug as per
http://eel.is/c++draft/unique.ptr#4.sentence-3

Reply via email to