Skip to content

Commit c49cba6

Browse files
committed
Minor updates to compile cppfront and the new test cleanly using MSVC
And re-remove a few stray `;` that were removed as part of PR hsutter#911 and now cause errors because of the pedantic builds I regenerated `reflect.h` and found two changes that weren't already in the PR, so committing those too Also including the new test file's run against MSVC showing the five messages mentioned in the PR review, see PR review for more...
1 parent 26a5f49 commit c49cba6

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pure2-last-use.cpp
2+
pure2-last-use.cpp2(193): error C3889: call to object of class type 'issue_857::o2::<lambda_1>': no matching call operator found
3+
pure2-last-use.cpp2(193): note: could be 'decltype(auto) issue_857::o2::<lambda_1>::operator ()(Obj &&,Params &&...) noexcept(<expr>) const'
4+
pure2-last-use.cpp2(193): note: the associated constraints are not satisfied
5+
pure2-last-use.cpp2(193): note: the constraint was not satisfied
6+
pure2-last-use.cpp2(314): warning C4552: '+': result of expression not used
7+
pure2-last-use.cpp2(315): warning C4552: '+': result of expression not used
8+
pure2-last-use.cpp2(316): warning C4552: '+': result of expression not used
9+
pure2-last-use.cpp2(317): warning C4552: '+': result of expression not used

source/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
#ifdef _MSC_VER
15-
#pragma warning(disable: 4456)
15+
#pragma warning(disable: 4456 4706)
1616
#endif
1717

1818
#include "cpp2util.h"
@@ -334,7 +334,7 @@ auto is_nondigit(char c)
334334
isalpha(c)
335335
|| c == '_'
336336
;
337-
};
337+
}
338338

339339
//G identifier-start:
340340
//G nondigit
@@ -379,7 +379,7 @@ auto starts_with_identifier(std::string_view s)
379379
return j;
380380
}
381381
return 0;
382-
};
382+
}
383383

384384

385385
// Helper to allow one of the above or a digit separator

source/lex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ auto _as(lexeme l)
199199
break;case lexeme::None: return "(NONE)";
200200
break;default: return "INTERNAL-ERROR";
201201
}
202-
};
202+
}
203203

204204

205205
auto is_operator(lexeme l)

source/reflect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ auto ordered_impl(
13521352
if (CPP2_UFCS(has_name)(mf, "operator<=>")) {
13531353
has_spaceship = true;
13541354
auto return_name {CPP2_UFCS(unnamed_return_type)(mf)};
1355-
if (CPP2_UFCS(find)(return_name, ordering) == std::move(return_name).npos)
1355+
if (CPP2_UFCS(find)(return_name, ordering) == return_name.npos)
13561356
{
13571357
CPP2_UFCS(error)(mf, "operator<=> must return std::" + cpp2::as_<std::string>(ordering));
13581358
}
@@ -1951,7 +1951,7 @@ auto print(cpp2::in<meta::type_declaration> t) -> void
19511951
&& !(CPP2_UFCS(arguments_were_used)(rtype))))
19521952

19531953
{
1954-
error(name + " did not use its template arguments - did you mean to write '" + std::move(name) + " <" + CPP2_ASSERT_IN_BOUNDS(std::move(args), 0) + "> type' (with the spaces)?");
1954+
error(name + " did not use its template arguments - did you mean to write '" + name + " <" + CPP2_ASSERT_IN_BOUNDS(std::move(args), 0) + "> type' (with the spaces)?");
19551955
return false;
19561956
}
19571957
}

source/sema.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,10 @@ class sema
20322032

20332033
auto push(std::vector<std::pair<int, int>>& uses) -> void
20342034
{
2035-
uses.emplace_back(std::ssize(indices_of_uses_per_scope) - 1, std::ssize(indices_of_uses_per_scope.back()));
2035+
uses.emplace_back(
2036+
unsafe_narrow<int>(std::ssize(indices_of_uses_per_scope) - 1),
2037+
unsafe_narrow<int>(std::ssize(indices_of_uses_per_scope.back()))
2038+
);
20362039
}
20372040

20382041
auto get(std::vector<std::pair<int, int>>& uses) -> std::span<const int>

0 commit comments

Comments
 (0)