summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp184
1 files changed, 0 insertions, 184 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8320a7ae894..48eaceeb25a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4213,14 +4213,6 @@ Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
return TagD;
}
- if (DS.isConceptSpecified()) {
- // C++ Concepts TS [dcl.spec.concept]p1: A concept definition refers to
- // either a function concept and its definition or a variable concept and
- // its initializer.
- Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
- return TagD;
- }
-
DiagnoseFunctionSpecifiers(DS);
if (DS.isFriendSpecified()) {
@@ -5459,23 +5451,6 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D,
if (getLangOpts().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
- if (D.getDeclSpec().isConceptSpecified()) {
- // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
- // applied only to the definition of a function template or variable
- // template, declared in namespace scope
- if (!TemplateParamLists.size()) {
- Diag(D.getDeclSpec().getConceptSpecLoc(),
- diag:: err_concept_wrong_decl_kind);
- return nullptr;
- }
-
- if (!DC->getRedeclContext()->isFileContext()) {
- Diag(D.getIdentifierLoc(),
- diag::err_concept_decls_may_only_appear_in_namespace_scope);
- return nullptr;
- }
- }
-
NamedDecl *New;
bool AddToScope = true;
@@ -5694,9 +5669,6 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC,
if (D.getDeclSpec().isConstexprSpecified())
Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_invalid_constexpr)
<< 1;
- if (D.getDeclSpec().isConceptSpecified())
- Diag(D.getDeclSpec().getConceptSpecLoc(),
- diag::err_concept_wrong_decl_kind);
if (D.getName().Kind != UnqualifiedId::IK_Identifier) {
if (D.getName().Kind == UnqualifiedId::IK_DeductionGuideName)
@@ -6553,46 +6525,6 @@ NamedDecl *Sema::ActOnVariableDeclarator(
if (NewVD->isStaticDataMember() && getLangOpts().CPlusPlus17)
NewVD->setImplicitlyInline();
}
-
- if (D.getDeclSpec().isConceptSpecified()) {
- if (VarTemplateDecl *VTD = NewVD->getDescribedVarTemplate())
- VTD->setConcept();
-
- // C++ Concepts TS [dcl.spec.concept]p2: A concept definition shall not
- // be declared with the thread_local, inline, friend, or constexpr
- // specifiers, [...]
- if (D.getDeclSpec().getThreadStorageClassSpec() == TSCS_thread_local) {
- Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(),
- diag::err_concept_decl_invalid_specifiers)
- << 0 << 0;
- NewVD->setInvalidDecl(true);
- }
-
- if (D.getDeclSpec().isConstexprSpecified()) {
- Diag(D.getDeclSpec().getConstexprSpecLoc(),
- diag::err_concept_decl_invalid_specifiers)
- << 0 << 3;
- NewVD->setInvalidDecl(true);
- }
-
- // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
- // applied only to the definition of a function template or variable
- // template, declared in namespace scope.
- if (IsVariableTemplateSpecialization) {
- Diag(D.getDeclSpec().getConceptSpecLoc(),
- diag::err_concept_specified_specialization)
- << (IsPartialSpecialization ? 2 : 1);
- }
-
- // C++ Concepts TS [dcl.spec.concept]p6: A variable concept has the
- // following restrictions:
- // - The declared type shall have the type bool.
- if (!Context.hasSameType(NewVD->getType(), Context.BoolTy) &&
- !NewVD->isInvalidDecl()) {
- Diag(D.getIdentifierLoc(), diag::err_variable_concept_bool_decl);
- NewVD->setInvalidDecl(true);
- }
- }
}
if (D.getDeclSpec().isInlineSpecified()) {
@@ -6843,25 +6775,6 @@ NamedDecl *Sema::ActOnVariableDeclarator(
if (!IsVariableTemplateSpecialization)
D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous));
- // C++ Concepts TS [dcl.spec.concept]p7: A program shall not declare [...]
- // an explicit specialization (14.8.3) or a partial specialization of a
- // concept definition.
- if (IsVariableTemplateSpecialization &&
- !D.getDeclSpec().isConceptSpecified() && !Previous.empty() &&
- Previous.isSingleResult()) {
- NamedDecl *PreviousDecl = Previous.getFoundDecl();
- if (VarTemplateDecl *VarTmpl = dyn_cast<VarTemplateDecl>(PreviousDecl)) {
- if (VarTmpl->isConcept()) {
- Diag(NewVD->getLocation(), diag::err_concept_specialized)
- << 1 /*variable*/
- << (IsPartialSpecialization ? 2 /*partially specialized*/
- : 1 /*explicitly specialized*/);
- Diag(VarTmpl->getLocation(), diag::note_previous_declaration);
- NewVD->setInvalidDecl();
- }
- }
- }
-
if (NewTemplate) {
VarTemplateDecl *PrevVarTemplate =
NewVD->getPreviousDecl()
@@ -8315,7 +8228,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
bool isVirtual = D.getDeclSpec().isVirtualSpecified();
bool isExplicit = D.getDeclSpec().isExplicitSpecified();
bool isConstexpr = D.getDeclSpec().isConstexprSpecified();
- bool isConcept = D.getDeclSpec().isConceptSpecified();
isFriend = D.getDeclSpec().isFriendSpecified();
if (isFriend && !isInline && D.isFunctionDefinition()) {
// C++ [class.friend]p5
@@ -8527,89 +8439,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_constexpr_dtor);
}
- if (isConcept) {
- // This is a function concept.
- if (FunctionTemplateDecl *FTD = NewFD->getDescribedFunctionTemplate())
- FTD->setConcept();
-
- // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
- // applied only to the definition of a function template [...]
- if (!D.isFunctionDefinition()) {
- Diag(D.getDeclSpec().getConceptSpecLoc(),
- diag::err_function_concept_not_defined);
- NewFD->setInvalidDecl();
- }
-
- // C++ Concepts TS [dcl.spec.concept]p1: [...] A function concept shall
- // have no exception-specification and is treated as if it were specified
- // with noexcept(true) (15.4). [...]
- if (const FunctionProtoType *FPT = R->getAs<FunctionProtoType>()) {
- if (FPT->hasExceptionSpec()) {
- SourceRange Range;
- if (D.isFunctionDeclarator())
- Range = D.getFunctionTypeInfo().getExceptionSpecRange();
- Diag(NewFD->getLocation(), diag::err_function_concept_exception_spec)
- << FixItHint::CreateRemoval(Range);
- NewFD->setInvalidDecl();
- } else {
- Context.adjustExceptionSpec(NewFD, EST_BasicNoexcept);
- }
-
- // C++ Concepts TS [dcl.spec.concept]p5: A function concept has the
- // following restrictions:
- // - The declared return type shall have the type bool.
- if (!Context.hasSameType(FPT->getReturnType(), Context.BoolTy)) {
- Diag(D.getIdentifierLoc(), diag::err_function_concept_bool_ret);
- NewFD->setInvalidDecl();
- }
-
- // C++ Concepts TS [dcl.spec.concept]p5: A function concept has the
- // following restrictions:
- // - The declaration's parameter list shall be equivalent to an empty
- // parameter list.
- if (FPT->getNumParams() > 0 || FPT->isVariadic())
- Diag(NewFD->getLocation(), diag::err_function_concept_with_params);
- }
-
- // C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is
- // implicity defined to be a constexpr declaration (implicitly inline)
- NewFD->setImplicitlyInline();
-
- // C++ Concepts TS [dcl.spec.concept]p2: A concept definition shall not
- // be declared with the thread_local, inline, friend, or constexpr
- // specifiers, [...]
- if (isInline) {
- Diag(D.getDeclSpec().getInlineSpecLoc(),
- diag::err_concept_decl_invalid_specifiers)
- << 1 << 1;
- NewFD->setInvalidDecl(true);
- }
-
- if (isFriend) {
- Diag(D.getDeclSpec().getFriendSpecLoc(),
- diag::err_concept_decl_invalid_specifiers)
- << 1 << 2;
- NewFD->setInvalidDecl(true);
- }
-
- if (isConstexpr) {
- Diag(D.getDeclSpec().getConstexprSpecLoc(),
- diag::err_concept_decl_invalid_specifiers)
- << 1 << 3;
- NewFD->setInvalidDecl(true);
- }
-
- // C++ Concepts TS [dcl.spec.concept]p1: The concept specifier shall be
- // applied only to the definition of a function template or variable
- // template, declared in namespace scope.
- if (isFunctionTemplateSpecialization) {
- Diag(D.getDeclSpec().getConceptSpecLoc(),
- diag::err_concept_specified_specialization) << 1;
- NewFD->setInvalidDecl(true);
- return NewFD;
- }
- }
-
// If __module_private__ was specified, mark the function accordingly.
if (D.getDeclSpec().isModulePrivateSpecified()) {
if (isFunctionTemplateSpecialization) {
@@ -10825,17 +10654,6 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
}
}
- // C++ Concepts TS [dcl.spec.concept]p1: [...] A variable template
- // definition having the concept specifier is called a variable concept. A
- // concept definition refers to [...] a variable concept and its initializer.
- if (VarTemplateDecl *VTD = Var->getDescribedVarTemplate()) {
- if (VTD->isConcept()) {
- Diag(Var->getLocation(), diag::err_var_concept_not_initialized);
- Var->setInvalidDecl();
- return;
- }
- }
-
// OpenCL v1.1 s6.5.3: variables declared in the constant address space must
// be initialized.
if (!Var->isInvalidDecl() &&
@@ -11751,8 +11569,6 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
if (DS.isConstexprSpecified())
Diag(DS.getConstexprSpecLoc(), diag::err_invalid_constexpr)
<< 0;
- if (DS.isConceptSpecified())
- Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
DiagnoseFunctionSpecifiers(DS);
OpenPOWER on IntegriCloud