[PATCH] D26843: Make sizeof expression context partially evaluated
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 11:17:21 PST 2016
EricWF added a comment.
In case your wondering *why* this happens
In https://reviews.llvm.org/D26843#599804, @pmatos wrote:
> In https://reviews.llvm.org/D26843#599673, @EricWF wrote:
>
> > > But that is not valid in C afaik and in C++ I get:
> > >
> > > error: invalid use of non-static data member 'm'
> > > int x = sizeof(T::m);
> > > ~~~^
> > >
> > >
> > > Can you post a full reproducible example of what the change breaks?
> >
> > That is a full reproducible example because it's valid C++. Clang currently compiles it <http://melpon.org/wandbox/permlink/tSMVyoCLPsrKfZ2P>.
>
>
> But what was in the link was:
>
> typedef struct { int m; } T;
> int x = sizeof(T);
> int main() {}
>
>
> This is different from your initial snippet and compiles fine with my patch.
Sorry your right. That should still say `sizeof(T::m)`. My mistake.
https://reviews.llvm.org/D26843
More information about the cfe-commits
mailing list