Nathan-Huckleberry marked an inline comment as done.
Nathan-Huckleberry added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:352
   SetParamDefaultArgument(Param, DefaultArg, EqualLoc);
+  CurContext->removeDecl(Param);
+  CurContext = Cur;
----------------
rsmith wrote:
> We may need to delay the diagnostics here until the default argument is 
> *used*: if a default argument references a template instantiation, the 
> instantiation is not performed until that point, which may mean that our 
> semantic checking can't complete correctly until use.
Currently this patch really only works with globals. There are many places 
where the following check is made instead of calling `ParseInitializer`. These 
should probably be rewritten into a single function and do something similar 
with pushing/popping declarations. Not sure if that change should be made in 
this patch or not.

```
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
            Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
            DefArgResult = ParseBraceInitializer();
          } else
            DefArgResult = ParseAssignmentExpression();
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63889/new/

https://reviews.llvm.org/D63889



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D63889: C... Nathan Huckleberry via Phabricator via cfe-commits

Reply via email to