Skip to content
Snippets Groups Projects
  • Nico Weber's avatar
    2f89cf41
    Fix rejects-valid caused by r261297. · 2f89cf41
    Nico Weber authored
    r261297 called hasUserProvidedDefaultConstructor() to check if defining a
    const object is ok.  This is incorrect for this example:
    
      struct X { template<typename ...T> X(T...); int n; };
      const X x; // formerly OK, now bogus error
    
    Instead, track if a class has a defaulted default constructor, and disallow
    a const object for classes that either have defaulted default constructors or
    if they need an implicit constructor.
    
    Bug report and fix approach by Richard Smith, thanks!
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261770 91177308-0d34-0410-b5e6-96231b3b80d8
    2f89cf41
    History
    Fix rejects-valid caused by r261297.
    Nico Weber authored
    r261297 called hasUserProvidedDefaultConstructor() to check if defining a
    const object is ok.  This is incorrect for this example:
    
      struct X { template<typename ...T> X(T...); int n; };
      const X x; // formerly OK, now bogus error
    
    Instead, track if a class has a defaulted default constructor, and disallow
    a const object for classes that either have defaulted default constructors or
    if they need an implicit constructor.
    
    Bug report and fix approach by Richard Smith, thanks!
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261770 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.