[llvm-bugs] [Bug 26448] New: Ternary operator: Incorrect value category
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 3 02:43:46 PST 2016
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: unassignedclangbugs at nondot.org
Reporter: roman.perepelitsa at gmail.com
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160203/b7457db4/attachment.html>
More information about the llvm-bugs
mailing list