commit fb2e3bd25d2b8ce5cde5facf156941c7eae5d643
Author: Jason Merrill <jason@redhat.com>
Date: Mon May 4 21:09:11 2015 -0500
* decl.c (start_decl): Don't push the plain VAR_DECL for a
variable template.
@@ -4825,8 +4825,11 @@ start_decl (const cp_declarator *declarator,
was_public = TREE_PUBLIC (decl);
- /* Enter this declaration into the symbol table. */
- decl = maybe_push_decl (decl);
+ /* Enter this declaration into the symbol table. Don't push the plain
+ VAR_DECL for a variable template. */
+ if (!template_parm_scope_p ()
+ || TREE_CODE (decl) != VAR_DECL)
+ decl = maybe_push_decl (decl);
if (processing_template_decl)
decl = push_template_decl (decl);
new file mode 100644
@@ -0,0 +1,5 @@
+// { dg-do compile { target c++14 } }
+
+template <class T> bool Foo = Foo<int>;
+template <> bool Foo<int> = true;
+int i = Foo<char>;