[PATCH] Sema: Instantiate local class and their members appropriately

Richard Smith richard at metafoo.co.uk
Mon Nov 25 12:50:55 PST 2013


  LGTM with some tiny tweaks. Thank you!


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:674-677
@@ -665,5 +673,6 @@
   // not the definitions of scoped member enumerations.
   // FIXME: There appears to be no wording for what happens for an enum defined
   // within a block scope, but we treat that much like a member template. Only
   // instantiate the definition when visiting the definition in that case, since
   // we will visit all redeclarations.
+  if (isDeclWithinFunction(D) ? D == Def : (Def && !Enum->isScoped())) {
----------------
Please add a reference to the relevant DR here.

================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:736
@@ -726,3 +735,3 @@
       if (Pattern->getDeclContext()->isFunctionOrMethod() &&
-          !Enum->isScoped()) {
+          !Enum->isScoped() && !Enum->isScoped()) {
         // If the enumeration is within a function or method, record the enum
----------------
This change looks unnecessary =)

================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:1140
@@ +1139,3 @@
+
+  if (D->isCompleteDefinition() && D->isLocalClass()) {
+    if (SemaRef.InstantiateClass(D->getLocation(), Record, D, TemplateArgs,
----------------
A brief comment mentioning the DR would be helpful here.


http://llvm-reviews.chandlerc.com/D2236

BRANCH
  PR9685

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list