r269397 - Extend this test to also be valid in C++14.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 23:42:56 PDT 2016


Author: rsmith
Date: Fri May 13 01:42:55 2016
New Revision: 269397

URL: http://llvm.org/viewvc/llvm-project?rev=269397&view=rev
Log:
Extend this test to also be valid in C++14.

Modified:
    cfe/trunk/test/SemaCXX/constexpr-nqueens.cpp

Modified: cfe/trunk/test/SemaCXX/constexpr-nqueens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-nqueens.cpp?rev=269397&r1=269396&r2=269397&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constexpr-nqueens.cpp (original)
+++ cfe/trunk/test/SemaCXX/constexpr-nqueens.cpp Fri May 13 01:42:55 2016
@@ -10,26 +10,26 @@ struct Board {
   constexpr Board(const Board &O) : State(O.State), Failed(O.Failed) {}
   constexpr Board(uint64_t State, bool Failed = false) :
     State(State), Failed(Failed) {}
-  constexpr Board addQueen(int Row, int Col) {
+  constexpr Board addQueen(int Row, int Col) const {
     return Board(State | ((uint64_t)Row << (Col * 4)));
   }
-  constexpr int getQueenRow(int Col) {
+  constexpr int getQueenRow(int Col) const {
     return (State >> (Col * 4)) & 0xf;
   }
-  constexpr bool ok(int Row, int Col) {
+  constexpr bool ok(int Row, int Col) const {
     return okRecurse(Row, Col, 0);
   }
-  constexpr bool okRecurse(int Row, int Col, int CheckCol) {
+  constexpr bool okRecurse(int Row, int Col, int CheckCol) const {
     return Col == CheckCol ? true :
            getQueenRow(CheckCol) == Row ? false :
            getQueenRow(CheckCol) == Row + (Col - CheckCol) ? false :
            getQueenRow(CheckCol) == Row + (CheckCol - Col) ? false :
            okRecurse(Row, Col, CheckCol + 1);
   }
-  constexpr bool at(int Row, int Col) {
+  constexpr bool at(int Row, int Col) const {
     return getQueenRow(Col) == Row;
   }
-  constexpr bool check(const char *, int=0, int=0);
+  constexpr bool check(const char *, int=0, int=0) const;
 };
 
 constexpr Board buildBoardRecurse(int N, int Col, const Board &B);
@@ -54,7 +54,7 @@ constexpr Board buildBoard(int N) {
 
 constexpr Board q8 = buildBoard(8);
 
-constexpr bool Board::check(const char *p, int Row, int Col) {
+constexpr bool Board::check(const char *p, int Row, int Col) const {
   return
     *p == '\n' ? check(p+1, Row+1, 0) :
     *p == 'o' ? at(Row, Col) && check(p+1, Row, Col+1) :




More information about the cfe-commits mailing list