http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59141

            Bug ID: 59141
           Summary: [C++11] Bogus copy constructor required for direct
                    initialization with empty variadic pack
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Possibly related to PR58940

Google ref: b/11696404

Confirmed with current trunk:
g++ (GCC) 4.9.0 20131114 (experimental)

g++ -c -std=c++11 t.cc
t.cc: In instantiation of ‘void Construct(Args ...) [with Args = {}]’:
t.cc:13:13:   required from here
t.cc:8:26: error: use of deleted function ‘NonCopyable::NonCopyable(const
NonCopyable&)’
   NonCopyable obj(args...);
                          ^
t.cc:3:3: note: declared here
   NonCopyable(const NonCopyable&) = delete;
   ^

The test:

struct NonCopyable {
  NonCopyable() {}
  NonCopyable(const NonCopyable&) = delete;
};

template <class... Args>
void Construct(Args... args) {
  NonCopyable obj(args...);
  (void)obj;
}

int main() {
  Construct();
}


There is no error if 'obj' is initialized with {args...} instead of (args...).

There is also no error if NonCopyable has a constructor from int and an int is
passed to Construct.

Reply via email to