Skip to content
Snippets Groups Projects
  • graeser's avatar
    ab8abefc
    Disable the constructor from anything · ab8abefc
    graeser authored
    It is unclear where and if it is needed and it's very dangerous for the
    following reason: Suppose the that you have some class
    
    class C
    {
        C(const NullOperator<A>& a): a_(a) {}
        const NullOperator<A>& a_;
    };
    
    and make the not so unlikely error to call the constructor of C
    with a NullOperator<B>. Then the code will silently compile but the
    'a_' is a reference to an invalid temporary after the constructor call.
    
    [[Imported from SVN: r8227]]
    ab8abefc
    History
    Disable the constructor from anything
    graeser authored
    It is unclear where and if it is needed and it's very dangerous for the
    following reason: Suppose the that you have some class
    
    class C
    {
        C(const NullOperator<A>& a): a_(a) {}
        const NullOperator<A>& a_;
    };
    
    and make the not so unlikely error to call the constructor of C
    with a NullOperator<B>. Then the code will silently compile but the
    'a_' is a reference to an invalid temporary after the constructor call.
    
    [[Imported from SVN: r8227]]
Code owners
Assign users and groups as approvers for specific file changes. Learn more.