]> granicus.if.org Git - clang/commit
Fix rejects-valid caused by r261297.
authorNico Weber <nicolasweber@gmx.de>
Wed, 24 Feb 2016 20:58:14 +0000 (20:58 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 24 Feb 2016 20:58:14 +0000 (20:58 +0000)
commit2f89cf41352f6e87f68f12ff25466970482729e3
treea15c6f6640096644cfc22c0c36ea788b051943a6
parent209acc3e3dae1499aca767441406403f77ccc8ee
Fix rejects-valid caused by r261297.

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
include/clang/AST/DeclCXX.h
lib/AST/ASTImporter.cpp
lib/AST/DeclCXX.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
test/SemaCXX/cxx0x-cursory-default-delete.cpp