saar.raz updated this revision to Diff 194978.
saar.raz added a comment.

Add new CodeSynthesisContexts to switch where they were missing


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D41217/new/

https://reviews.llvm.org/D41217

Files:
  lib/Frontend/FrontendActions.cpp
  test/Parser/cxx2a-concept-declaration.cpp

Index: test/Parser/cxx2a-concept-declaration.cpp
===================================================================
--- test/Parser/cxx2a-concept-declaration.cpp
+++ test/Parser/cxx2a-concept-declaration.cpp
@@ -27,12 +27,12 @@
 concept C2 = true; // expected-error {{extraneous template parameter list in concept definition}}
 
 template<typename T> concept C3 = true; // expected-note {{previous}} expected-note {{previous}}
-int C4; // expected-error {{redefinition}}
-struct C4 {}; // expected-error {{redefinition}}
+int C3; // expected-error {{redefinition}}
+struct C3 {}; // expected-error {{redefinition}}
 
-struct C5 {}; // expected-note{{previous definition is here}}
-template<typename T> concept C5 = true;
-// expected-error@-1{{redefinition of 'C5' as different kind of symbol}}
+struct C4 {}; // expected-note{{previous definition is here}}
+template<typename T> concept C4 = true;
+// expected-error@-1{{redefinition of 'C4' as different kind of symbol}}
 
 // TODO: Add test to prevent explicit specialization, partial specialization
 // and explicit instantiation of concepts.
@@ -41,55 +41,55 @@
 struct integral_constant { static constexpr T value = v; };
 
 namespace N {
-  template<typename T> concept C6 = true;
+  template<typename T> concept C5 = true;
 }
-using N::C6;
+using N::C5;
 
-template <bool word> concept C7 = integral_constant<bool, wor>::value;
+template <bool word> concept C6 = integral_constant<bool, wor>::value;
 // expected-error@-1{{use of undeclared identifier 'wor'; did you mean 'word'?}}
 // expected-note@-2{{'word' declared here}}
 
-template<typename T> concept bool C8 = true;
+template<typename T> concept bool C7 = true;
 // expected-error@-1{{'bool' keyword after 'concept' is no longer valid in C++2a; remove it}}
 
-template<> concept C9 = false;
+template<> concept C8 = false;
 // expected-error@-1{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed, did you attempt this?}}
 
-template<> concept C8<int> = false;
+template<> concept C7<int> = false;
 // expected-error@-1{{name defined in concept definition must be an identifier}}
 
-template<typename T> concept N::C12 = false;
+template<typename T> concept N::C9 = false;
 // expected-error@-1{{unexpected namespace scope before concept name; concepts must be defined inside their namespace, if any}}
 
 class A { };
 // expected-note@-1{{'A' declared here}}
 
-template<typename T> concept A::C13 = false;
+template<typename T> concept A::C10 = false;
 // expected-error@-1{{expected namespace name}}
 
 template<typename T> concept operator int = false;
 // expected-error@-1{{name defined in concept definition must be an identifier}}
 
-template<bool x> concept C14 = 2; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C15 = 2 && x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C16 = x || 2 || x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
-template<bool x> concept C17 = 8ull && x || x; // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long long')}}
-template<typename T> concept C18 = sizeof(T); // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long')}}
-template<typename T> concept C19 = T{};
-static_assert(!C19<bool>);
-template<typename T> concept C20 = (bool&&)true;
-static_assert(C20<int>);
-template<typename T> concept C21 = (const bool&)true;
-static_assert(C21<int>);
-template<typename T> concept C22 = (const bool)true;
-static_assert(C22<int>);
-template <bool c> concept C23 = integral_constant<bool, c>::value && true;
-static_assert(C23<true>);
-static_assert(!C23<false>);
-template <bool c> concept C24 = integral_constant<bool, c>::value;
-static_assert(C24<true>);
-static_assert(!C24<false>);
-
-template <bool word> concept C25 = integral_constant<bool, wor>::value;
+template<bool x> concept C11 = 2; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
+template<bool x> concept C12 = 2 && x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
+template<bool x> concept C13 = x || 2 || x; // expected-error {{atomic constraint must be of type 'bool' (found 'int')}}
+template<bool x> concept C14 = 8ull && x || x; // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long long')}}
+template<typename T> concept C15 = sizeof(T); // expected-error {{atomic constraint must be of type 'bool' (found 'unsigned long')}}
+template<typename T> concept C16 = T{};
+static_assert(!C16<bool>);
+template<typename T> concept C17 = (bool&&)true;
+static_assert(C17<int>);
+template<typename T> concept C18 = (const bool&)true;
+static_assert(C18<int>);
+template<typename T> concept C19 = (const bool)true;
+static_assert(C19<int>);
+template <bool c> concept C20 = integral_constant<bool, c>::value && true;
+static_assert(C20<true>);
+static_assert(!C20<false>);
+template <bool c> concept C21 = integral_constant<bool, c>::value;
+static_assert(C21<true>);
+static_assert(!C21<false>);
+
+template <bool word> concept C22 = integral_constant<bool, wor>::value;
 // expected-error@-1{{use of undeclared identifier 'wor'; did you mean 'word'?}}
 // expected-note@-2{{'word' declared here}}
Index: lib/Frontend/FrontendActions.cpp
===================================================================
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -416,6 +416,10 @@
       return "DefiningSynthesizedFunction";
     case CodeSynthesisContext::Memoization:
       return "Memoization";
+    case CodeSynthesisContext::ConstraintsCheck:
+      return "ConstraintsCheck";
+    case CodeSynthesisContext::ConstraintSubstitution:
+      return "ConstraintSubstitution";
     }
     return "";
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to