[LLVMbugs] [Bug 16114] New: Incorrect linkage for testcase with local static in an inline member function of a local type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 22 14:07:56 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16114

            Bug ID: 16114
           Summary: Incorrect linkage for testcase with local static in an
                    inline member function of a local type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dblaikie at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    rafael.espindola at gmail.com
    Classification: Unclassified

f.h:
inline int *f() {
  struct {
    int* f() {
      static int i;
      return &i;
    }
  } s;
  return s.f();
}

a.cpp:
#include "f.h"
int *x() {
  return f();
}

b.cpp:
#include <iostream>
#include "f.h"
int *x();
int *y() {
  return f();
}
int main() {
  std::cout << x() << ", " << y() << '\n';
}

clang++ -O2 a.cpp b.cpp && ./a.out
0x601154, 0x60115c

This should print the same address twice.

-- 
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/20130522/5a939fa9/attachment.html>


More information about the llvm-bugs mailing list