[llvm-bugs] [Bug 35862] New: -Wmissing-variable-declarations warnings trigger on inline variables and variable temples

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 8 13:19:41 PST 2018


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

            Bug ID: 35862
           Summary: -Wmissing-variable-declarations warnings trigger on
                    inline variables and variable temples
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: metaprogrammingtheworld at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

When using -Wmissing-variable-declarations, the warning incorrectly triggers
for both inline variable definitions and for variable templates. Example
warning trigger:

//////////
template< class >
int variable_template = 5;

inline constexpr int inline_variable = 5;
//////////

When compiling the above code, the following warnings are produced:

//////////
2 : <source>:2:5: warning: no previous extern declaration for non-static
variable 'variable_template' [-Wmissing-variable-declarations]
int variable_template = 5;
    ^
4 : <source>:4:22: warning: no previous extern declaration for non-static
variable 'inline_variable' [-Wmissing-variable-declarations]
inline constexpr int inline_variable = 5;
//////////

I suggest that such definitions should be ignored in the context of that
warning.

-- 
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/20180108/6ee218c1/attachment.html>


More information about the llvm-bugs mailing list