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

* [Bug c++/19883] [4.0 regression] Even more array bounds rejected as non-constant in template...
  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 ` pinskia at gcc dot gnu dot org
  2005-02-11  5:54 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-11  5:42 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/19883] [4.0 regression] Even more array bounds rejected as non-constant in template...
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-11  5:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-10 23:16 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-10 23:16:13
               date|                            |


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


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

* [Bug c++/19883] [4.0 regression] Even more array bounds rejected as non-constant in template...
  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
  4 siblings, 0 replies; 6+ messages in thread
From: bredelin at ucla dot edu @ 2005-02-17 20:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bredelin at ucla dot edu  2005-02-17 16:45 -------
Note that this bug breaks BOOST.

Here is a reduced testcase, which comes from boost/mpl/aux_/integral_wrapper.hpp:

------------------ begin testcase
template< typename T, T N >
struct integral_c
{
  static const T value = N;

  typedef integral_c< T, static_cast<T>((value + 1)) > next;
  //  typedef integral_c< T, static_cast<T>((value - 1)) > prior;

  //  operator T() const { return static_cast<T>(this->value); }
};
------------------- end testcase 
% g++-cvs testcase.C
c.C:6: error: template argument 2 is invalid


The original error was obtained by including <boost/numeric/ublas/matrix.hpp>
The following error was recieved:

In file included from /usr/include/boost/config.hpp:35,
                 from /usr/include/boost/numeric/ublas/config.hpp:24,
                 from /usr/include/boost/numeric/ublas/matrix.hpp:20,
                 from a.C:1:
/usr/include/boost/config/compiler/gcc.hpp:92:7: warning: #warning "Unknown
compiler version - please run the configure tests and report the results"
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:72: error: template argument 2
is invalid
/usr/include/boost/mpl/aux_/integral_wrapper.hpp:73: error: template argument 2
is invalid





-- 


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


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

* [Bug c++/19883] [4.0 regression] Even more array bounds rejected as non-constant in template...
  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
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-02-23  5:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/19883] [4.0 regression] Even more array bounds rejected as non-constant in template...
  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
                   ` (3 preceding siblings ...)
  2005-02-23  5:36 ` mmitchel at gcc dot gnu dot org
@ 2005-02-23  6:35 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-02-23  6:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-02-22 21:47 -------
Fixed in 4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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).