<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - "defaulted outside the class" error when it *is* outside the class"
   href="http://llvm.org/bugs/show_bug.cgi?id=16237">16237</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"defaulted outside the class" error when it *is* outside the class
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>temporal@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The error "explicitly-defaulted copy constructor with a non-const parameter
must be defaulted outside the class, unless a base or member requires the
parameter to be non-const" seems to fire even when the constructor *is*
defaulted outside the class, if the class happens to be a template.  GCC
accepts this code.

PS.  Out of curiosity, why does this requirement exist?  I couldn't find an
explanation online -- this seems to be a pretty obscure corner case.

$ cat bug.c++
template <typename T>
struct S {
  S() = default;
  S(S&);
};

template <typename T>
S<T>::S(S<T>&) = default;

void f() {
  S<int> s;
  S<int> s2(s);
}

$ clang++ -std=c++11 -c bug.c++
bug.c++:4:3: error: explicitly-defaulted copy constructor with a non-const
parameter must be
      defaulted outside the class, unless a base or member requires the
parameter to be non-const
  S(S&);
  ^
bug.c++:12:10: note: in instantiation of member function 'S<int>::S' requested
here
  S<int> s2(s);
         ^
1 error generated.
$ g++ -std=c++11 -c bug.c++
$ clang++ --version
Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM
3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>