<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - invalid application of 'sizeof' to an incomplete type 'B<typename std::decay<int>::type>' (aka 'B<int>')"
href="https://bugs.llvm.org/show_bug.cgi?id=31976">31976</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>invalid application of 'sizeof' to an incomplete type 'B<typename std::decay<int>::type>' (aka 'B<int>')
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</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>C++14
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ajneu1@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following code, when compiled with
clang++-3.9 -std=c++14 -o go main.cpp
gives this error:
error: invalid application of 'sizeof' to an incomplete type 'B<typename
std::decay<int>::type>' (aka 'B<int>')
See <a href="http://melpon.org/wandbox/permlink/vMiEuyYyKk9Ya4aX">http://melpon.org/wandbox/permlink/vMiEuyYyKk9Ya4aX</a>
But it works find with gcc: <a href="http://melpon.org/wandbox/permlink/xmSu58FRGFTm84RW">http://melpon.org/wandbox/permlink/xmSu58FRGFTm84RW</a>
///////////////////////////////////////////////
#include <iostream>
template <typename T1>
struct A {
template <typename T2>
struct B {
public:
static const std::size_t Size = (sizeof(B<typename std::decay<T2>::type>));
/*
// workaround
static constexpr std::size_t Size() {
return (sizeof(B<typename std::decay<T2>::type>));
}
*/
private:
T2 t_;
};
};
int main()
{
std::cout << A<int>::B<int>::Size << std::endl;
return 0;
}
///////////////////////////////////////////////</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>