Bug 27015 - strange warning when init std::tr1::array
Summary: strange warning when init std::tr1::array
Status: RESOLVED DUPLICATE of bug 25137
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 05:41 UTC by LI Daobing
Modified: 2006-04-04 05:44 UTC (History)
4 users (show)

See Also:
Host: i486-pc-linux-gnu
Target: i486-pc-linux-gnu
Build: i486-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LI Daobing 2006-04-04 05:41:28 UTC

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 LI Daobing 2006-04-04 05:41:28 UTC
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
Comment 2 Andrew Pinski 2006-04-04 05:44:33 UTC

*** This bug has been marked as a duplicate of 25137 ***