[llvm-bugs] [Bug 41368] New: clang++ accepts self-referring static member initialization

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 3 16:31:24 PDT 2019


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

            Bug ID: 41368
           Summary: clang++ accepts self-referring static member
                    initialization
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eyalroz at technion.ac.il
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

GodBolt example: https://godbolt.org/z/1orC3P
StackOverflow question (which started out differently):
https://stackoverflow.com/q/55505257/1593077

Consider the following code:

  struct bar { static const bool value = !bar::value; };

This should not compile; and indeed, it doesn't - with GCC and with MSVC. Yet
clang++ is somehow willing to take a default-initialization value for
bar::value before it has actually been initialized. I am not a C++ language
lawyer, but I'm sure that's wrong.

-- 
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/20190403/8c30fc86/attachment-0001.html>


More information about the llvm-bugs mailing list