it to find out its type. */
if ((decl_maybe_constant_var_p (decl)
|| (TREE_CODE (decl) == FUNCTION_DECL
- && (DECL_DECLARED_CONSTEXPR_P (decl)
- || type_uses_auto (TREE_TYPE (TREE_TYPE (decl))))))
+ && DECL_DECLARED_CONSTEXPR_P (decl))
+ || type_uses_auto (TREE_TYPE (decl)))
&& DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_INFO (decl)
&& !uses_template_parms (DECL_TI_ARGS (decl)))
--function_depth;
}
+ if (processing_template_decl)
+ return true;
+
+ /* Check this too in case we're within fold_non_dependent_expr. */
+ if (DECL_TEMPLATE_INFO (decl)
+ && uses_template_parms (DECL_TI_ARGS (decl)))
+ return true;
+
if (type_uses_auto (TREE_TYPE (decl)))
{
error ("use of %qD before deduction of %<auto%>", decl);
if (cp_unevaluated_operand != 0)
return true;
- if (processing_template_decl)
- return true;
-
- /* Check this too in case we're within fold_non_dependent_expr. */
- if (DECL_TEMPLATE_INFO (decl)
- && uses_template_parms (DECL_TI_ARGS (decl)))
- return true;
-
DECL_ODR_USED (decl) = 1;
if (DECL_CLONED_FUNCTION_P (decl))
DECL_ODR_USED (DECL_CLONED_FUNCTION (decl)) = 1;
--- /dev/null
+// PR c++/54903
+// { dg-options -std=c++11 }
+
+template<int N, int D>
+struct Modulus
+{
+ static auto const value = N % D;
+};
+
+template<int N>
+struct Angle
+{
+ static auto const value = Modulus<N, 360>::value; // ERROR
+ //static int const value = Modulus<N, 360>::value; // OK
+ //static auto const value = N % 360; // OK
+
+ typedef Angle<value> type;
+};