[llvm-bugs] [Bug 46642] New: -Wuninitialized diagnostic missing for operator-> usage

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 8 09:38:39 PDT 2020


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

            Bug ID: 46642
           Summary: -Wuninitialized diagnostic missing for operator->
                    usage
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: antoshkka at gmail.com
                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

Consider the example:


struct A {
  A();
  A& foo();
  A* operator->();
};

struct B {
  B(A&);
};

struct composed2 {
  B b_;
  A a_;
  composed2() : b_(a_->foo()), a_() {} // does not warn!
  //composed2(int) : b_(a_.foo()), a_() {} // warns
};


We are calling an operator-> on a uninitialized variable `a_`, but the
diagnostic is missing.

Godbolt playground: https://godbolt.org/z/Ty8bgA

-- 
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/20200708/ee02d891/attachment.html>


More information about the llvm-bugs mailing list