[llvm-bugs] [Bug 25437] New: Ranged-for scoping problem

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 6 14:04:34 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25437

            Bug ID: 25437
           Summary: Ranged-for scoping problem
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matze at braunis.de
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following program compiles fine with clang but fails on gcc. I assume
either gcc or clang violate some scoping rules here (though I don't know which
one is at fault).

#include <vector>
struct S { int field; };
int main(void)
{
    std::vector<S> x;
    for (S &x : x) {
        return x.field;
    }
    return 0;
}

(Originally found with apple clang-700, but also reproduces with the clang/gcc
versions at https://gcc.godbolt.org)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151106/9a31b8cb/attachment.html>


More information about the llvm-bugs mailing list