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

            Bug ID: 28391
           Summary: ASAN incorrectly flags ODR violation on C++17 inline
                    variables when one definition is compiled in C++14.
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Reproducer:
// Steps to reproduce:
// clang++ -std=c++14 -fsanitize=address -DTU_ONE -shared -fPIC -o libfoo.so
test.cpp
// clang++ -std=c++1z -fsanitize=address test.cpp libfoo.so
// ./a.out
// EXPECTED: exit success
// ACTUAL:  AddressSanitizer: odr-violation
struct Foo {
 static constexpr bool inline_var = true;
};
#ifdef TU_ONE
constexpr bool Foo::inline_var;
#else
void test(const bool&) {}
int main() {
    test(Foo::inline_var);
}
#endif

In the above reproducer the main program generates a definition for
Foo::inline_var according to the C++17 inline variable rules. The program then
links to a library compiled as C++14 which provides the explicit definition for
`Foo::inline_bool`. When this program is run ASAN will emit an odr-violation
diagnostic for 'inline_bool'.

I believe this diagnostic is a false positive even though one of the two
definitions was not compiled with C++17 inline variable semantics.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to