public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19883] New: [4.0 regression] Even more array bounds rejected as non-constant in template...
@ 2005-02-11  1:54 reichelt at gcc dot gnu dot org
  2005-02-11  5:42 ` [Bug c++/19883] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-11  1:54 UTC (permalink / raw)
  To: gcc-bugs

The following valid code snippet is rejected by mainline:

====================================
template<typename T> struct A
{
    static const T i = 1;
    char a[int(i)];
};
====================================

The error message is:
  bug1.cc:4: error: array bound is not an integer constant


Mark, this is similar to PR19826 which you already fixed, but with an
additional cast.

For the same reason the following testcase fails, too:

==================================
template<int> struct A {};

template<typename T> struct B
{
    static const T i = 2;
    A<int(i)> a;
};
==================================

bug2.cc:6: error: template argument 1 is invalid

Due to this problem the testcase in PR19297 still fails on mainline.

-- 
           Summary: [4.0 regression] Even more array bounds rejected as non-
                    constant in template...
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
                    com


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


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

end of thread, other threads:[~2005-02-22 21:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-11  1:54 [Bug c++/19883] New: [4.0 regression] Even more array bounds rejected as non-constant in template reichelt at gcc dot gnu dot org
2005-02-11  5:42 ` [Bug c++/19883] " pinskia at gcc dot gnu dot org
2005-02-11  5:54 ` pinskia at gcc dot gnu dot org
2005-02-17 20:48 ` bredelin at ucla dot edu
2005-02-23  5:36 ` mmitchel at gcc dot gnu dot org
2005-02-23  6:35 ` mmitchel at gcc dot gnu dot 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).