summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-12-16 23:12:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-12-16 23:12:52 +0000
commitd52186ff5a397bb2335e6ee14ab37ead2bac3b67 (patch)
tree6bd4ce430e7f7fbbf70c259b6d6eaacc6ebb79b6 /clang/lib/Sema
parent5413abf88f6fce158517b87614d5660102e0b58d (diff)
downloadbcm5719-llvm-d52186ff5a397bb2335e6ee14ab37ead2bac3b67.tar.gz
bcm5719-llvm-d52186ff5a397bb2335e6ee14ab37ead2bac3b67.zip
DR1684: a constexpr member function need not be a member of a literal class type.
llvm-svn: 224388
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp36
1 files changed, 0 insertions, 36 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index ec87b850ba7..b2a765b53a9 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -4894,42 +4894,6 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
for (auto *M : Record->methods())
DiagnoseAbsenceOfOverrideControl(M);
}
- // C++11 [dcl.constexpr]p8: A constexpr specifier for a non-static member
- // function that is not a constructor declares that member function to be
- // const. [...] The class of which that function is a member shall be
- // a literal type.
- //
- // If the class has virtual bases, any constexpr members will already have
- // been diagnosed by the checks performed on the member declaration, so
- // suppress this (less useful) diagnostic.
- //
- // We delay this until we know whether an explicitly-defaulted (or deleted)
- // destructor for the class is trivial.
- if (LangOpts.CPlusPlus11 && !Record->isDependentType() &&
- !Record->isLiteral() && !Record->getNumVBases()) {
- for (const auto *M : Record->methods()) {
- if (M->isConstexpr() && M->isInstance() && !isa<CXXConstructorDecl>(M)) {
- switch (Record->getTemplateSpecializationKind()) {
- case TSK_ImplicitInstantiation:
- case TSK_ExplicitInstantiationDeclaration:
- case TSK_ExplicitInstantiationDefinition:
- // If a template instantiates to a non-literal type, but its members
- // instantiate to constexpr functions, the template is technically
- // ill-formed, but we allow it for sanity.
- continue;
-
- case TSK_Undeclared:
- case TSK_ExplicitSpecialization:
- RequireLiteralType(M->getLocation(), Context.getRecordType(Record),
- diag::err_constexpr_method_non_literal);
- break;
- }
-
- // Only produce one error per class.
- break;
- }
- }
- }
// ms_struct is a request to use the same ABI rules as MSVC. Check
// whether this class uses any C++ features that are implemented
OpenPOWER on IntegriCloud