[llvm-bugs] [Bug 33389] New: __is_transparent check requires too much

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 9 15:08:32 PDT 2017


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

            Bug ID: 33389
           Summary: __is_transparent check requires too much
           Product: libc++
           Version: 4.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rs2740 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

__is_transparent checks for the nested is_transparent typedef by attempting to
form a pointer to it. That means it gives the wrong answer in cases where
key_­compare​::​is_­transparent "is valid and denotes a type" to which a
pointer cannot be formed (such as reference types and abominable function
types).

#include <functional>
#include <set>

enum class Test {};

bool operator<(int, Test) { return true; }
bool operator<(Test, int) { return false; }

struct evil_less : std::less<> {
    using is_transparent = void() const &;  //int& breaks, too.
};

int main() {
    std::set<int, evil_less> s;
    s.find(Test{});
}

-- 
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/20170609/bd0b1eef/attachment.html>


More information about the llvm-bugs mailing list