https://llvm.org/bugs/show_bug.cgi?id=26448
Bug ID: 26448 Summary: Ternary operator: Incorrect value category Product: clang Version: 3.7 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: roman.perepeli...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified The following program unexpectedly triggers the static assertion. #include <type_traits> template <class T, class U> using common = decltype(true ? std::declval<T>() : std::declval<U>()); struct base {}; struct derived : base {}; // common<base, derived> is expected to be base&& (see [expr.cond]/3.2), // but clang produces base. Hence the assertion fails. static_assert(std::is_same<common<base, derived>, base&&>(), ""); GCC works correctly on this code snippet. Note that the following assertion holds (expected behaviour): static_assert(std::is_same<common<base, base>, base&&>(), ""); Confirmed for clang up to 3.7.1 via gcc.godbolt.org (http://goo.gl/srkhK5). -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs