[llvm-bugs] [Bug 28390] New: Clang incorrectly emits definition for undefined constexpr static data member.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 1 14:14:06 PDT 2016


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

            Bug ID: 28390
           Summary: Clang incorrectly emits definition for undefined
                    constexpr static data member.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Reproducer:
//---------------------
struct Foo {
 static const bool undefined = true; // still is correctly undefined
 static constexpr bool incorrectly_defined = true; // clang emits a definition
};
void test(const bool&) {}
int main() {
    test(Foo::incorrectly_defined); // shouldn't link
    // test(Foo::undefined); // doesn't link
}
//------------------------

Clang has started emitting a definition for "incorrectly_defined", this means
the above test case compiles and links successfully when it could fail to
compile. It also causes ODR violations when "incorrectly_defined" is actually
defined in another TU.

Note that Clang did not emit a definition for this code in 3.8, and I think it
started within the last two weeks, since that's when I started noticing errors.

-- 
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/20160701/24f46bc9/attachment.html>


More information about the llvm-bugs mailing list