------- Comment #6 from brolley at redhat dot com  2007-06-07 15:48 -------
As Andrew Pinski has noted, 4.2.0 rejects the code with a proper error message.
The latest trunk does the same. The change which fixes this is

2006-08-20  Mark Mitchell  <[EMAIL PROTECTED]>

        PR c++/28341
        * tree.c (cast_valid_in_integral_constant_expression_p): New
        function.
        * cp-tree.h (tsubst_copy_and_build): Adjust prototype.
        * pt.c (tsubst_expr): Add integral_constant_expression_p
        parameter.
        (fold_non_dependent_expr): Adjust callers of
        tsubst_{expr,copy_and_build}.
        (tsubst_friend_function): Likewise.
        (tsubst_template_arg): Likewise.
        (tsubst_default_argument): Likewise.
        (tsubst_decl): Likewise.
        (tsubst): Likewise.
        (tsubst_omp_clasuses): Likewise.
        (regenerate_decl_fromp_template): Likewise.
        (instantiate_decl): Likewise.
        (tsubst_initializer_list): Likewise.
        (tsubst_enum): Likewise.
        (tsubst_expr): Use RECUR throughout.
        (tsubst_copy_and_build): Change definition of RECUR.  Do not allow
        invalid casts in integral constant expressions.

I'm attaching a patch for gcc-4_1_branch which brings in this change.


-- 

brolley at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brolley at redhat dot com


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

Reply via email to