[llvm-bugs] [Bug 28582] New: [experimental/optional] test bugs

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 15 21:28:27 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28582

            Bug ID: 28582
           Summary: [experimental/optional] test bugs
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Casey at Carter.net
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 16750
  --> https://llvm.org/bugs/attachment.cgi?id=16750&action=edit
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.

-- 
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/20160716/ba0837f8/attachment-0001.html>


More information about the llvm-bugs mailing list