re PR c++/10750 (error with using template template expression in static const initia...
authorGiovanni Bajo <giovannibajo@libero.it>
Mon, 30 Jun 2003 18:45:25 +0000 (20:45 +0200)
committerWolfgang Bangerth <bangerth@gcc.gnu.org>
Mon, 30 Jun 2003 18:45:25 +0000 (12:45 -0600)
2003-06-30  Giovanni Bajo  <giovannibajo@libero.it>

        PR c++/10750
        * parser.c (cp_parser_primary_expression): A VAR_DECL with a
        (value- or type-) dependent expression as DECL_INITIAL is a
        valid constant-expression (at parser time).

From-SVN: r68720

gcc/cp/ChangeLog
gcc/cp/parser.c

index 9d84c82274c2e8d4b3ec6371a68b2b151ca9b974..821c85f8151987acf49eb9e7431c6067f399b7e5 100644 (file)
@@ -1,3 +1,10 @@
+2003-06-30  Giovanni Bajo  <giovannibajo@libero.it>
+
+        PR c++/10750
+        * parser.c (cp_parser_primary_expression): A VAR_DECL with a
+        (value- or type-) dependent expression as DECL_INITIAL is a
+        valid constant-expression (at parser time).
+
 2003-06-30  Giovanni Bajo <giovannibajo@libero.it>
 
         PR c++/11106
index 21166190b8baa2a13b774c20ba56284baaa2fd39..46351153bf16ca2ad6e50955442b8a2da4ddf52b 100644 (file)
@@ -2783,11 +2783,16 @@ cp_parser_primary_expression (cp_parser *parser,
                     && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl)))
                /* Const variables or static data members of integral
                   or enumeration types initialized with constant
-                  expressions.  */
+     expressions (or dependent expressions - in this case
+     the check will be done at instantiation time). */
                && !(TREE_CODE (decl) == VAR_DECL
                     && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (decl))
                     && DECL_INITIAL (decl)
-                    && TREE_CONSTANT (DECL_INITIAL (decl))))
+       && (TREE_CONSTANT (DECL_INITIAL (decl))
+    || type_dependent_expression_p 
+       (DECL_INITIAL (decl))
+    || value_dependent_expression_p 
+       (DECL_INITIAL (decl)))))
              {
                if (!parser->allow_non_constant_expression_p)
                  return cp_parser_non_constant_id_expression (decl);