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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.5.3, 4.7.0
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|                            |2012-01-12
     Ever Confirmed|0                           |1
            Summary|internal compiler error: in |[4.6 Regression] internal
                   |convert_nontype_argument,   |compiler error: in
                   |at cp/pt.c:5408             |convert_nontype_argument,
                   |                            |at cp/pt.c:5408
   Target Milestone|---                         |4.6.3
      Known to fail|                            |4.6.2

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-12 
09:17:30 UTC ---
Confirmed.

> g++ -S t.C 
t.C: In function 'int main(int, char**)':
t.C:8:26: error: cast from 'const char*' to 'int' loses precision
[-fpermissive]
t.C:8:31: error: '(int)((long int)"123")' is not a constant expression
t.C:8:31: note: in template argument for type 'int' 

> g++ -S t.C -m32
t.C: In function 'int main(int, char**)':
t.C:8:31: internal compiler error: in convert_nontype_argument, at cp/pt.c:5408
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

On trunk:

> g++ -S t.C -m32 -B /abuild/rguenther/trunk-g/gcc
t.C: In function 'int main(int, char**)':
t.C:8:31: error: conversion from pointer type 'const char (*)[4]' to arithmetic
type 'int' in a constant-expression
t.C:8:31: note: in template argument for type 'int' 

so it's invalid source, fixed on trunk.  4.5 says

g++ -S t.C -m32
t.C: In function 'int main(int, char**)':
t.C:8:31: error: '(int)"123"' is not a valid template argument for type 'int'
because it is a non-constant expression

Reply via email to