http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55149

--- Comment #11 from David Abdurachmanov <david.abdurachmanov at gmail dot com> 
---
(In reply to Jason Merrill from comment #10)

Hi Jason,

Compiled fine in 4.8.0, fails in 4.9.0 (r199649). That's the smallest I could
get in this time. It produces two errors for the same line.

david

cat <<\EOF > test.cxx

template<unsigned int TA>
 struct SA
 {
   SA (const int & PA);
   int nt;
 };

template<typename TB>
 inline void
 test(TB aa)
 {
   ;
 }

template<unsigned int TA>
 inline
 SA<TA>::SA(const int & PA)
 {
   float e[nt];
   test([&e](int i, int j){ return e[i] < e[j]; });
 }

int main()
{
 int d;
 SA<2> iso(d);
 return 0;
}
EOF

### GCC COMMAND ###

c++ -c -DGNU_GCC -D_GNU_SOURCE -O2 -pthread -pipe -Werror=main
-Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Wno-overflow
-Wno-strict-overflow -std=c++0x -msse3 -ftree-vectorize -Wno-strict-overflow
-Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits
-fvisibility-inlines-hidden -fno-math-errno --param
vect-max-version-for-alias-checks=50 -fipa-pta -felide-constructors
-fmessage-length=0 -ftemplate-depth-300 -Wall -Wno-non-template-friend
-Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated
-Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address
-Werror=format -Werror=sign-compare -Werror=write-strings
-Werror=delete-non-virtual-dtor -Werror=maybe-uninitialized
-Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized
-Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable
-Werror=conversion-null -Werror=switch -fdiagnostics-show-option
-Wno-unused-local-typedefs -Wabi -fPIC test.cxx -o test.o

### GCC OUTPUT ###

test.cxx: In instantiation of 'struct SA<TA>::SA(const int&) [with unsigned int
TA = 2u]::<lambda>':
test.cxx:20:50:   required from 'SA<TA>::SA(const int&) [with unsigned int TA =
2u]'
test.cxx:26:13:   required from here
test.cxx:20:11: error: size of array is not an integral constant-expression
    test([&e](int i, int j){ return e[i] < e[j]; });
           ^
test.cxx: In instantiation of 'SA<TA>::SA(const int&) [with unsigned int TA =
2u]':
test.cxx:26:13:   required from here
test.cxx:20:9: error: invalid initialization of reference of type 'float
(&)[1]' from expression of type 'float [((SA<2u>*)this)->SA<2u>::nt]'
    test([&e](int i, int j){ return e[i] < e[j]; });
         ^

Reply via email to