This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Possible bad warning on tr1::array initializer.


All,

I wrote this little snippet:
-----------------------------------------------------
#include <tr1/array>

int main(int, char**)
{
  std::tr1::array<double,3> ad = {0.0, 0.0, 1.0};
  std::tr1::array<unsigned long,2> aul = {0, 1};
  return 0;
}
-----------------------------------------------------

I compiled with -Wall:

$ bin-4.1.0/bin/g++ -Wall array.cpp 
array.cpp: In function 'int main(int, char**)':
array.cpp:5: warning: missing braces around initializer for 'double [3]'
array.cpp:6: warning: missing braces around initializer for 'long
unsigned int [2]'
array.cpp:5: warning: unused variable 'ad'
array.cpp:6: warning: unused variable 'aul'

The first two warnings seem incorrect to me.

This is with:
$ bin-4.1.0/bin/g++ -v      
Using built-in specs.
Target: i686-pc-cygwin
Configured with: ../gcc-4.1.0/configure
--prefix=/home/ESmith-rowland/bin-4.1.0 --enable-languages=c,c++
Thread model: single
gcc version 4.1.0

I'll try this with a 4.2 build at home.

Ed Smith-Rowland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]