+2014-08-13 Andrew Sutton <andrew.n.sutton@gmail.com>
+
+ * pt.c (lookup_template_variable): Make dependent variable templates
+ have unknown type.
+
2014-08-13 Paolo Carlini <paolo.carlini@oracle.com>
* parser.c (cp_parser_elaborated_type_specifier): Handle
return ret;
}
-/* Return a TEMPLATE_ID_EXPR for the given variable template and ARGLIST. */
+/* Return a TEMPLATE_ID_EXPR for the given variable template and ARGLIST.
+ If the ARGLIST refers to any template parameters, the type of the
+ expression is the unknown_type_node since the template-id could
+ refer to an explicit or partial specialization. */
tree
lookup_template_variable (tree templ, tree arglist)
{
- return build2 (TEMPLATE_ID_EXPR, TREE_TYPE (templ), templ, arglist);
+ tree type;
+ if (uses_template_parms (arglist))
+ type = unknown_type_node;
+ else
+ type = TREE_TYPE (templ);
+ return build2 (TEMPLATE_ID_EXPR, type, templ, arglist);
}
+
\f
struct pair_fn_data
{
--- /dev/null
+// { dg-options "-std=c++1y" }
+
+template<typename T>
+ constexpr bool Class = __is_class(T);
+
+template<typename T>
+ constexpr bool Test = Class<T>;
+
+struct S { };
+
+static_assert(!Test<int>, "");
+static_assert(Test<S>, "");