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

            Bug ID: 47365
           Summary: Can not use a struct type of base containing both enum
                    and protected destructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

The following code is accepted by g++, while is rejected by clang++.

$ cat s.cpp

enum class A {
};

struct B {
    A a;
protected:
    ~B() = default;
};

struct C : B {
};

int main(){
    C c{};
}

$ g++ -c s.cpp
success.

$ clang++ -v
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
ab4627364aefcaac751e757b721b7d07b48a545a)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang++ -c s.cpp

s.cpp:14:9: error: temporary of type 'B' has protected destructor
    C c{};
        ^
s.cpp:7:5: note: declared protected here
    ~B() = default;  
    ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to