Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • New: error: ... cannot appear in a constant-expression

    18 answers - 85 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Compilers without errors using
    gcc 3.3
    MSVC 7.1
    MSVC 8.0
    Comeau 4.3.3
  • No.1 | | 132 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 09:42
    Created an attachment (id=9514)
    ()
    source code
  • No.2 | | 143 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 09:44
    Created an attachment (id=9515)
    ()
    command (error) output
  • No.3 | | 150 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 09:44
    Created an attachment (id=9516)
    ()
    command that produces the bug
  • No.4 | | 140 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 09:45
    Created an attachment (id=9517)
    ()
    preprocessed source
  • No.5 | | 137 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 09:45
    Created an attachment (id=9518)
    ()
    assembler source
  • No.6 | | 224 bytes | |

    Additional Comments From jmihalicza at graphisoft dot com 2005-08-17 10:16
    (In reply to comment #0)
    Compilers without errors using
    ^ forget
    , I meant: Compiles
    gcc 3.3
    MSVC 7.1
    MSVC 8.0
    Comeau 4.3.3
  • No.7 | | 377 bytes | |

    --
    What |Removed |Added

    GCC build triplet|i486-pc-linux-gnu |
    GCC host triplet|i486-pc-linux-gnu |
    GCC target triplet|i486-pc-linux-gnu |
    Keywords| |rejects-valid
    Summary|error: cannot appear in |[3.4/4.0/4.1 Regression]
    |a constant-expression |error: cannot appear in
    | |a constant-expression
    Target Milestone| |4.0.2

  • No.8 | | 86 bytes | |

    Additional Comments From giovannibajo at libero dot it 2005-08-17 21:59
    Confirmed.
  • No.9 | | 86 bytes | |

    Additional Comments From giovannibajo at libero dot it 2005-08-17 22:13
    Dumdelidum
  • No.10 | | 109 bytes | |

    Additional Comments From giovannibajo at libero dot it 2005-08-19 18:06
    Patch posted, waiting for review:
  • No.11 | | 369 bytes | |

    Additional Comments From raghavan at cavs dot msstate dot edu 2005-09-04 21:36
    Subject: [3.4/4.0/4.1 Regression] error: cannot appear
    in a constant-expression

    Hi,
    Is this bug fixed? I'm still unable to use a static constant in
    an expression to declare another static constant. I'm using gcc version
    4.0.1

    Thanks,

    Sridhar
  • No.12 | | 182 bytes | |

    Additional Comments From giovannibajo at libero dot it 2005-09-05 23:28
    Not yet, I still have to find some time to commit the patch. It will be fixed
    in GCC 4.1 and GCC 4.0.2.
  • No.13 | | 148 bytes | |

    Additional Comments From may at cavs dot msstate dot edu 2005-09-08 20:33
    I applied that patch, but am still having the same problem. Any ideas?
  • No.14 | | 722 bytes | |

    Additional Comments From pannuri at cavs dot msstate dot edu 2005-09-12 18:39
    It seems this works:
    #include <math.h>
    #include <stdio.h>

    static const double PI = M_PI;
    static const double TWPI = (2.0*PI);
    static const double HALF_PI = (M_PI_2);
    static const double QUARTER_PI = (M_PI_4);

    main (int argc, char** argv) {
    int i = 0;
    printf("%ld\n", i);
    return 0;
    }

    But putting these inside of a class doesn't work:

    class Foo {
    Foo(){};
    ~Foo(){};
    static const double PI = M_PI;
    static const double TWPI = (2.0*PI);
    static const double HALF_PI = (M_PI_2);
    static const double QUARTER_PI = (M_PI_4);
    };
    -Madhulika
  • No.15 | | 274 bytes | |

    Additional Comments From pinskia at gcc dot gnu dot org 2005-09-12 20:45
    ICE started
    : Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk (#166).
    Then stoped:
    : Search converges between 2003-02-03-trunk (#174) and 2003-02-04-trunk (#175).
  • No.16 | | 84 bytes | |

    --
    What |Removed |Added
    Target Milestone|4.0.2 |4.0.3
  • No.17 | | 96 bytes | |

    Additional Comments From bonzini at gcc dot gnu dot org 2005-09-29 08:30
    Giovanni, any news?
  • No.18 | | 424 bytes | |

    Additional Comments From bonzini at gcc dot gnu dot org 2005-09-29 08:34
    But putting these inside of a class doesn't work:

    class Foo {
    Foo(){};
    ~Foo(){};
    static const double PI = M_PI;
    static const double TWPI = (2.0*PI);
    static const double HALF_PI = (M_PI_2);
    static const double QUARTER_PI = (M_PI_4);
    };

    However strange it may seem, this is not valid C

    See

    Paolo

Re: New: error: ... cannot appear in a constant-expression


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Development"

EMSDN.COM