[llvm-bugs] [Bug 25084] New: -Wunneeded-member-function incorrect for default constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 6 20:50:01 PDT 2015


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

            Bug ID: 25084
           Summary: -Wunneeded-member-function incorrect for default
                    constructor
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following program incorrectly warns:


#include <vector>

namespace {

struct default_constructible {
    default_constructible() = default;
};

}    // namespace

int main() {
    std::vector<default_constructible> v;
    v.emplace_back();
}



clang++ source/main.cpp -std=c++14 -Wunneeded-member-function -o /dev/null
source/main.cpp:6:2: warning: member function 'default_constructible' is not
needed and will not be
      emitted [-Wunneeded-member-function]
        default_constructible() = default;
        ^
1 warning generated.



clang++ -v
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0



Removing the default constructor leads to an error because emplace_back fails.

-- 
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/20151007/9379c033/attachment.html>


More information about the llvm-bugs mailing list