http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53488

Daniel Lunow <lunow at math dot hu-berlin.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lunow at math dot
                   |                            |hu-berlin.de

--- Comment #8 from Daniel Lunow <lunow at math dot hu-berlin.de> 2012-06-25 
00:32:00 UTC ---
Then you must have missed the example in 5.1.2 [expr.prim.lambda] p. 12.
[Example:
void f1(int i) {
  int const N = 20;
  auto m1 = [=]{
    int const M = 30;
    auto m2 = [i]{
      int x[N][M]; // OK: N and M are not odr-used
      // ...
    };
  };
  // ...
}
- end example]
Sure its non-normative, but this is what has always worked through a
combination of
8.3.4 [dcl.array], 3.4.1p1,6 [basic.lookup.unqual], 3.3.1p1
[basic.scope.declarative], 3.3.3p1,3 [basic.scope.local] and 5.19p2
[expr.const].

By the way the bug is independent of capturing by value/reference and in my
second example nothing is captured at all. It is not necessary to capture,
because i is not odr-used (5.1.2p11, 3.2p2).

I just put it here because, it occurs under the same circumstances 
 * constant integral local variable
 * initialized by an expression dependent on a template parameter, but not if
the initializer is the name of a non-template type parameter
 * used (but not odr-used) inside lambda.
and of course gcc has no problems with both examples, if i's initialization
does not depend on a template parameter.

Reply via email to