public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48911] New: [C++0x]An error that a valid array subscript
@ 2011-05-06  5:54 sscrisk at gmail dot com
  2011-05-06  9:28 ` [Bug c++/48911] [C++0x] Error for " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sscrisk at gmail dot com @ 2011-05-06  5:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x]An error that a valid array subscript
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sscrisk@gmail.com


Source:

int main()
{
 {
  constexpr int array[1] = {0};
  constexpr int i = array[0]; // OK.
 }
 {
  constexpr int array[1] = {};
  constexpr int i = array[0]; // error: array subscript out of bound. Why?
 }
}


Compile errors:

a.cpp: In function 'int main()':
a.cpp:5:17: warning: unused variable 'i' [-Wunused-variable]
a.cpp:9:28: error: array subscript out of bound
a.cpp:9:17: warning: unused variable 'i' [-Wunused-variable]


Access to array[0] is valid. But, compiler says "that's an error."


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-06 22:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06  5:54 [Bug c++/48911] New: [C++0x]An error that a valid array subscript sscrisk at gmail dot com
2011-05-06  9:28 ` [Bug c++/48911] [C++0x] Error for " paolo.carlini at oracle dot com
2011-05-06 11:05 ` jakub at gcc dot gnu.org
2011-05-06 14:16 ` jason at gcc dot gnu.org
2011-05-06 22:00 ` jason at gcc dot gnu.org
2011-05-06 22:04 ` jason at gcc dot gnu.org
2011-05-06 22:07 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).