This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [var-template] Accept variable template declaration


On 03/29/2013 06:29 PM, Gabriel Dos Reis wrote:
+  if (TREE_CODE (t) != TEMPLATE_DECL
+      || !(DECL_NAMESPACE_SCOPE_P (t) || DECL_MEMBER_TEMPLATE_P (t)))

Why check the scope?

-  if (!TYPE_P (ctx) || !CLASSTYPE_TEMPLATE_INFO (ctx))
-    permerror (DECL_SOURCE_LOCATION (decl),
-	       "%qD is not a static data member of a class template", decl);
+  if (!TYPE_P (ctx) || !CLASSTYPE_TEMPLATE_INFO (ctx)) {
+    if (cxx_dialect < cxx1y)
+      permerror (DECL_SOURCE_LOCATION (decl),
+                 "%qD is not a static data member of a class template", decl);
+  }
   else if (template_header_count > wanted)

I think we still want to check for excess template headers.

+      else if (VAR_P (decl)) {
+        if (!DECL_DECLARED_CONSTEXPR_P (decl))
+          error ("template declaration of non-constexpr variable %qD", decl);
+      }

Open brace should be on a line by itself.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]