when compile following file[1] with option `-Wall', it will give a
warning[2]. g++-4.0 do not has this problem. I don't think this
warning is proper.

[1]
// begin array2.cpp
#include <tr1/array>

int main() {
  std::tr1::array<int, 2> foo = {0, 1};
  return foo[1];
}
// end

[2]
array2.cpp: In function 'int main()':
array2.cpp:4: warning: missing braces around initializer for 'int [2]'

Environment:
System: Linux ldblab 2.6.16-1-686-smp #1 SMP Tue Mar 28 15:54:35 UTC
2006 i686 GNU/Linux
Architecture: i686


host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang
--prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre
--enable-mpfr --with-tune=i686 --enable-checking=release
i486-linux-gnu

How-To-Repeat:
  array.ii.bz2 is in attachment, uncompress it. then use
  'g++-4.1 -Wall -c array.ii' to reproduce this bug.


------- Comment #1 from lidaobing at gmail dot com  2006-04-04 05:41 -------
Fix:
  work around, the following code will not generate warning with
  '-Wall', but it looks strange.

// begin
#include <tr1/array>

int main() {
  std::tr1::array<int, 2> foo = {{0, 1}};
  return foo[1];
}
//end


--
LI Daobing


-- 
           Summary: strange warning when init std::tr1::array
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lidaobing at gmail dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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

Reply via email to