<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hello, 
<div class=""><br class="">
</div>
<div class="">We recently encountered an issue where clang has some unexpected behavior with respect to the capture of local references to global variables <a href="https://godbolt.org/z/KasP9K" class="">https://godbolt.org/z/KasP9K</a>.</div>
<div class=""><br class="">
</div>
<div class="">Most compilers (gcc, MSVC, icc) appear to create a member variable to hold the value of `myfoo` and have `dummy` return a size of 16.  Clang does not store a member for `myfoo` (in the AST there is no `FieldDecl` for `myfoo`). </div>
<div class=""><br class="">
</div>
<div class="">This leads to the interesting issue here: <a href="https://godbolt.org/z/G59e7M" class="">https://godbolt.org/z/G59e7M</a></div>
<div class="">Where clang and gcc will print out different values.  </div>
<div class=""><br class="">
</div>
<div class="">I don’t know if this is a clang issue (known?), or a {gcc,icc,msvc} issue, or is implementation defined, but any insight on this would be welcome.   </div>
<div class=""><br class="">
</div>
<div class="">-Drew </div>
</body>
</html>