]> granicus.if.org Git - clang/commit
Allow transformation of VariableArray to ConstantArray.
authorSerge Pavlov <sepavloff@gmail.com>
Thu, 6 Feb 2014 03:49:11 +0000 (03:49 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Thu, 6 Feb 2014 03:49:11 +0000 (03:49 +0000)
commitce4dc26cf4bf36fbb93d5ca3b8ae38f82c921396
tree7c7a888467dc5705a190de0640998379c53cbae8
parent8eacc54b2b06d3f0a998ec3adecaf890c7a25fb6
Allow transformation of VariableArray to ConstantArray.

In the following code:

    struct A { static const int sz; };
    template<class T> void f() { T arr[A::sz]; }

the array 'arr' is represented as a variable size array in the template.
If 'A::sz' gets value below in the translation unit, the array in
instantiation can turn into constant size array.

This change fixes PR18633.

Differential Revision: http://llvm-reviews.chandlerc.com/D2688

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200899 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/TreeTransform.h
test/SemaCXX/c99-variable-length-array.cpp