<html>
    <head>
      <base href="https://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 --- - [experimental/optional] test bugs"
   href="https://llvm.org/bugs/show_bug.cgi?id=28582">28582</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[experimental/optional] test bugs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Casey@Carter.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16750" name="attach_16750" title="Patch with fixes">attachment 16750</a> <a href="attachment.cgi?id=16750&action=edit" title="Patch with fixes">[details]</a></span>
Patch with fixes

I found a few bugs in the tests for experimental/optional that I recently
"borrowed":

* optional.object.assign/emplace_initializer_list.pass.cpp:

class Z
{
    // ...
    constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]),
j_(il.begin()[1])
        {throw 6;}
    // ...
};

and optional.object.ctor/initializer_list.pass.cpp:

class Z
{
    // ...
    constexpr Z(std::initializer_list<int> il) : i_(il.begin()[0]),
j_(il.begin()[1])
        {throw 6;}
    // ...
};

both contain an occurrence of a constexpr constructor that unconditionally
throws an exception. These constructors are ill-formed with no diagnostic
required per [dcl.constexpr]/5 since "no argument values exist such that an
invocation of the function or constructor could be ... a constant initializer
for some object".

The attached patch corrects these bugs by removing the constexpr specifier from
the constructors in question. It also removes the (redundant) test in
optional.object.ctor/initializer_list.pass.cpp that requires Z's
initializer_list constructor to be constexpr.

* optional.specalg/make_optional.pass.cpp has an instance of non-portable
behavior, it expects the moved-from state of a std::string to be empty:

    std::string s("123");
    optional<std::string> opt = make_optional(std::move(s));
    assert(*opt == "123");
    assert(s.empty());

The attached patch corrects the bug by removing this test case - without the
empty requirement it adds nothing over the following test case which ensures
that a moved-from unique_ptr is null.</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>