[PATCH] D139400: [clang] Show error when a local variables is passed as default template parameter
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 12:32:04 PDT 2023
shafik added inline comments.
================
Comment at: clang/test/SemaTemplate/default-template-arguments.cpp:12
+ auto lambda1 = [] <auto y = x_constexpr> {}; // expected-error {{default argument references local variable x_constexpr of enclosing function}}
+ auto lambda2 = [] <auto y = x_static> {}; // expected-error {{default argument references local variable x_static of enclosing function}}
+ auto lambda3 = [] <auto y = x_const> {}; // expected-error {{default argument references local variable x_const of enclosing function}}
----------------
massberg wrote:
> shafik wrote:
> > tahonermann wrote:
> > > MSVC and Clang currently accept `x_static`. The resolution of [[ https://cplusplus.github.io/CWG/issues/2346.html | CWG 2346 ]] suggests that this case (and maybe `x_constexpr`) should be accepted following the adoption of [[ https://wg21.link/p0588r1 | P0588R1 (Simplifying implicit lambda capture) ]]. However, it isn't obvious to me that P0588R1 actually addresses this. It might be worth following up with CWG to understand what the intent is.
> > I posted to the core reflector on this topic and there is already some feedback but let me wait to see if there is a consensus of this will need further discussions in core.
> Hi! Is there any update on this? How should I proceed?
I started the discussion here: https://lists.isocpp.org/core/2022/12/13642.php and there were a lot of points brought up. I think a core issue should have been opened but it does not look like it was.
I am following up now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139400/new/
https://reviews.llvm.org/D139400
More information about the cfe-commits
mailing list