summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-05-13 06:42:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-05-13 06:42:55 +0000
commit845d0d74bafd709b2179df73af4069ef459bf72f (patch)
tree92aaec2cfadb6c3a43cd1a2db0f79d1eeb093247 /clang
parent9469fe7de39219a6b7dc676c0ffefe035ace36ce (diff)
downloadbcm5719-llvm-845d0d74bafd709b2179df73af4069ef459bf72f.tar.gz
bcm5719-llvm-845d0d74bafd709b2179df73af4069ef459bf72f.zip
Extend this test to also be valid in C++14.
llvm-svn: 269397
Diffstat (limited to 'clang')
-rw-r--r--clang/test/SemaCXX/constexpr-nqueens.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/constexpr-nqueens.cpp b/clang/test/SemaCXX/constexpr-nqueens.cpp
index b158d6e4b6e..47133a29343 100644
--- a/clang/test/SemaCXX/constexpr-nqueens.cpp
+++ b/clang/test/SemaCXX/constexpr-nqueens.cpp
@@ -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) :
OpenPOWER on IntegriCloud