public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25222]  New: not integer constant error while casting static double const member to int in enum at compile-time
@ 2005-12-02 14:18 pkgm at o2 dot pl
  2005-12-02 14:19 ` [Bug c++/25222] " pkgm at o2 dot pl
  2005-12-02 15:17 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pkgm at o2 dot pl @ 2005-12-02 14:18 UTC (permalink / raw)
  To: gcc-bugs

//////////////////////////////////////////////
template<int i>
class A
{
public:
    static double const VAL = 0.5;

    enum
    {
        COS = (int)(A::VAL)
    };
};

int main()
{
    A<5>::COS;
    return 0;
}
//////////////////////////////////////////////

This returns following error:
pom.cpp: In instantiation of 'A<5>':
pom.cpp:15:   instantiated from here
pom.cpp:7: error: enumerator value for 'COS' not integer constant

>$ g++ -v -save-temps pom.cpp
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2
 /usr/lib/gcc/i486-linux-gnu/4.0.2/cc1plus -E -quiet -v -D_GNU_SOURCE pom.cpp
-mtune=i486 -fpch-preprocess -o pom.ii
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../include/c++/4.0.2
 /usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../include/c++/4.0.2/i486-linux-gnu
 /usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../include/c++/4.0.2/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.0.2/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux-gnu/4.0.2/cc1plus -fpreprocessed pom.ii -quiet
-dumpbase pom.cpp -mtune=i486 -auxbase pom -version -o pom.s
GNU C++ version 4.0.2 (i486-linux-gnu)
        compiled by GNU C version 4.0.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072


-- 
           Summary: not integer constant error while casting static double
                    const member to int in enum at compile-time
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pkgm at o2 dot pl
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


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

* [Bug c++/25222] not integer constant error while casting static double const member to int in enum at compile-time
  2005-12-02 14:18 [Bug c++/25222] New: not integer constant error while casting static double const member to int in enum at compile-time pkgm at o2 dot pl
@ 2005-12-02 14:19 ` pkgm at o2 dot pl
  2005-12-02 15:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pkgm at o2 dot pl @ 2005-12-02 14:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pkgm at o2 dot pl  2005-12-02 14:19 -------
Created an attachment (id=10389)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10389&action=view)
source code


-- 


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


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

* [Bug c++/25222] not integer constant error while casting static double const member to int in enum at compile-time
  2005-12-02 14:18 [Bug c++/25222] New: not integer constant error while casting static double const member to int in enum at compile-time pkgm at o2 dot pl
  2005-12-02 14:19 ` [Bug c++/25222] " pkgm at o2 dot pl
@ 2005-12-02 15:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-02 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-02 15:17 -------
Fixed in 4.0.3.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.3


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


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

end of thread, other threads:[~2005-12-02 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-02 14:18 [Bug c++/25222] New: not integer constant error while casting static double const member to int in enum at compile-time pkgm at o2 dot pl
2005-12-02 14:19 ` [Bug c++/25222] " pkgm at o2 dot pl
2005-12-02 15:17 ` pinskia 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).