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

David Blaikie <dblai...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 CC|                            |dblai...@gmail.com

--- Comment #1 from David Blaikie <dblai...@gmail.com> ---
This code (with the static member definition commented out) exhibits undefined
behavior due to an ODR use of 'foo' without a definition of 'foo'.

The "const static long long foo = 5;" (even with the "= 5") is only a
declaration of foo and must have an out of line definition (the initial value
("= 5") can remain in the declaration if you want/for various reasons).

If you want to keep the initial value inline at the declaration, then omit the
initial value in the definition (write it as "const long long Foo::foo;").

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

Reply via email to