[llvm-bugs] [Bug 31976] New: invalid application of 'sizeof' to an incomplete type 'B<typename std::decay<int>::type>' (aka 'B<int>')
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 15 13:24:20 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=31976
Bug ID: 31976
Summary: invalid application of 'sizeof' to an incomplete type
'B<typename std::decay<int>::type>' (aka 'B<int>')
Product: clang
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++14
Assignee: unassignedclangbugs at nondot.org
Reporter: ajneu1 at gmail.com
CC: llvm-bugs at lists.llvm.org
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 http://melpon.org/wandbox/permlink/vMiEuyYyKk9Ya4aX
But it works find with gcc: http://melpon.org/wandbox/permlink/xmSu58FRGFTm84RW
///////////////////////////////////////////////
#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;
}
///////////////////////////////////////////////
--
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/20170215/491459f7/attachment.html>
More information about the llvm-bugs
mailing list