Hi All, Here's a simple patch that fixes a bug in VarDecl::getSourceRange() which occurs when a static member array has an element type with an implicit initializer expression.
Basically, this detect the edge case where the initializer has no size and
falls back on the usual DeclaratorDecl::getSourceRange() allowing any
postfix tokens to be included in the range calculation.
All tests passed locally, but I'm afraid I didn't have a chance to
construct a suitable test-case. However the following snippet reproduces
the issue if needed. Either way I hope this should be safe to commit.
----
struct ElemType { char padding[16]; };
class TemplatedClass
{
public:
static ElemType Arr[4];
};
ElemType TemplatedClass::Arr[4]; // Issue: '[4]' missing from
VarDecl::getSourceRange()
static TemplatedClass Instance;
----
Cheers,
Will.
static-member-array-source-range-fix.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
