shafik added inline comments.
================
Comment at: clang/lib/Sema/SemaTemplate.cpp:1594
+ if (VarDecl *VD = dyn_cast<VarDecl>(DRE->getDecl())) {
+ if (VD->isLocalVarDecl()) {
+ Diag(DRE->getLocation(),
----------------
So if we look at `CheckDefaultArgumentVisitor::VistDeclRefExpr` it has a
comment about having to check ODR use due to [cwg
2346](https://cplusplus.github.io/CWG/issues/2346.html) and I believe you
should be using that as well.
Which would make your example below pass since the variable is `const` see:
https://godbolt.org/z/78Tojh6q5
It looks like neither gcc nor MSVC implement this DR.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139400/new/
https://reviews.llvm.org/D139400
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits