Skip to content

Commit f2fbe55

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/autodiff
2 parents c5258a2 + c388eff commit f2fbe55

File tree

12 files changed

+1942
-1583
lines changed

12 files changed

+1942
-1583
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pure2-default-arguments.cpp2:6:61: error: no member named 'source_location' in namespace 'std'
2-
char const* fn = CPP2_UFCS_NONLOCAL(function_name)(std::source_location::current())
3-
~~~~~^
1+
pure2-default-arguments.cpp2:6:77: error: no member named 'source_location' in namespace 'std'
2+
cpp2::impl::in<char const*> fn = CPP2_UFCS_NONLOCAL(function_name)(std::source_location::current())
3+
~~~~~^
44
1 error generated.

regression-tests/test-results/gcc-10-c++20/pure2-default-arguments.cpp.output

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ In file included from pure2-default-arguments.cpp:7:
44
../../../include/cpp2util.h:10047:15: note: in expansion of macro ‘CPP2_FORWARD’
55
../../../include/cpp2util.h:10066:22: note: in expansion of macro ‘CPP2_UFCS_CONSTRAINT_ARG’
66
../../../include/cpp2util.h:10096:59: note: in expansion of macro ‘CPP2_UFCS_’
7-
pure2-default-arguments.cpp2:6:22: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
7+
pure2-default-arguments.cpp2:6:38: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
88
../../../include/cpp2util.h:10047:92: error: local variable ‘params’ may not appear in this context
99
../../../include/cpp2util.h:10008:34: note: in definition of macro ‘CPP2_UFCS_IDENTITY’
1010
../../../include/cpp2util.h:10047:79: note: in expansion of macro ‘CPP2_FORWARD’
1111
../../../include/cpp2util.h:10066:22: note: in expansion of macro ‘CPP2_UFCS_CONSTRAINT_ARG’
1212
../../../include/cpp2util.h:10096:59: note: in expansion of macro ‘CPP2_UFCS_’
13-
pure2-default-arguments.cpp2:6:22: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
13+
pure2-default-arguments.cpp2:6:38: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
1414
../../../include/cpp2util.h:10048:74: error: local variable ‘obj’ may not appear in this context
1515
../../../include/cpp2util.h:10008:34: note: in definition of macro ‘CPP2_UFCS_IDENTITY’
1616
../../../include/cpp2util.h:10048:61: note: in expansion of macro ‘CPP2_FORWARD’
1717
../../../include/cpp2util.h:10066:22: note: in expansion of macro ‘CPP2_UFCS_CONSTRAINT_ARG’
1818
../../../include/cpp2util.h:10096:59: note: in expansion of macro ‘CPP2_UFCS_’
19-
pure2-default-arguments.cpp2:6:22: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
19+
pure2-default-arguments.cpp2:6:38: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
2020
../../../include/cpp2util.h:10048:93: error: local variable ‘params’ may not appear in this context
2121
../../../include/cpp2util.h:10008:34: note: in definition of macro ‘CPP2_UFCS_IDENTITY’
2222
../../../include/cpp2util.h:10048:80: note: in expansion of macro ‘CPP2_FORWARD’
2323
../../../include/cpp2util.h:10066:22: note: in expansion of macro ‘CPP2_UFCS_CONSTRAINT_ARG’
2424
../../../include/cpp2util.h:10096:59: note: in expansion of macro ‘CPP2_UFCS_’
25-
pure2-default-arguments.cpp2:6:22: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
26-
pure2-default-arguments.cpp2:6:61: error: ‘std::source_location’ has not been declared
25+
pure2-default-arguments.cpp2:6:38: note: in expansion of macro ‘CPP2_UFCS_NONLOCAL’
26+
pure2-default-arguments.cpp2:6:77: error: ‘std::source_location’ has not been declared
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pure2-default-arguments.cpp
2+
pure2-default-arguments.cpp2(6): error C7595: 'std::source_location::current': call to immediate function is not a constant expression

regression-tests/test-results/pure2-default-arguments.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ template<typename T = int, int N = 42> class myclass;
2121
// Older compilers will emit failures for this test case.
2222
#line 5 "pure2-default-arguments.cpp2"
2323
auto my_function_name(
24-
char const* fn = CPP2_UFCS_NONLOCAL(function_name)(std::source_location::current())
24+
cpp2::impl::in<char const*> fn = CPP2_UFCS_NONLOCAL(function_name)(std::source_location::current())
2525
) -> void;
2626

2727
#line 12 "pure2-default-arguments.cpp2"
@@ -58,7 +58,7 @@ auto main(int const argc_, char** argv_) -> int;
5858

5959
#line 5 "pure2-default-arguments.cpp2"
6060
auto my_function_name(
61-
char const* fn
61+
cpp2::impl::in<char const*> fn
6262
) -> void
6363
{
6464
std::cout << "calling: " + cpp2::to_string(fn) + "\n";

regression-tests/test-results/pure2-types-order-independence-and-nesting.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ class X {
6464
class Y {
6565
private: X* px;
6666

67-
public: Y(X* x);
67+
public: Y(cpp2::impl::in<X*> x);
6868
#line 49 "pure2-types-order-independence-and-nesting.cpp2"
69-
public: auto operator=(X* x) -> Y& ;
69+
public: auto operator=(cpp2::impl::in<X*> x) -> Y& ;
7070

7171
public: auto why(cpp2::impl::in<int> count) const& -> void;
7272
public: Y(Y const&) = delete; /* No 'that' constructor, suppress copy */
@@ -157,10 +157,10 @@ namespace N {
157157
}
158158

159159
#line 49 "pure2-types-order-independence-and-nesting.cpp2"
160-
Y::Y(X* x)
160+
Y::Y(cpp2::impl::in<X*> x)
161161
: px{ x }{}
162162
#line 49 "pure2-types-order-independence-and-nesting.cpp2"
163-
auto Y::operator=(X* x) -> Y& {
163+
auto Y::operator=(cpp2::impl::in<X*> x) -> Y& {
164164
px = x;
165165
return *this; }
166166

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
cppfront compiler v0.8.2 Build A815:1039
2+
cppfront compiler v0.8.2 Build A827:1455
33
SPDX-License-Identifier Apache-2.0 WITH LLVM-exception
44
Copyright (c) 2022-2025 Herb Sutter

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"A815:1039"
1+
"A827:1455"

source/parse.h

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,6 +3542,7 @@ struct declaration_node
35423542
// Attributes currently configurable only via metafunction API,
35433543
// not directly in the base language grammar
35443544
bool member_function_generation = true;
3545+
bool ref_qualifier_generation = true;
35453546

35463547
// Cache some context
35473548
bool is_a_template_parameter = false;
@@ -3637,6 +3638,12 @@ struct declaration_node
36373638
member_function_generation = false;
36383639
}
36393640

3641+
auto type_disable_ref_qualifier_generation()
3642+
-> void
3643+
{
3644+
ref_qualifier_generation = false;
3645+
}
3646+
36403647
auto object_type() const
36413648
-> std::string
36423649
{
@@ -6403,6 +6410,9 @@ class parser
64036410
{
64046411
std::vector<error_entry>& errors;
64056412
std::set<std::string>& includes;
6413+
std::vector<std::string>& extra_cpp1;
6414+
std::vector<std::string>& extra_build;
6415+
std::string filename;
64066416

64076417
std::unique_ptr<translation_unit_node> parse_tree = {};
64086418

@@ -6529,20 +6539,38 @@ class parser
65296539
//
65306540
parser(
65316541
std::vector<error_entry>& errors_,
6532-
std::set<std::string>& includes_
6542+
std::set<std::string>& includes_,
6543+
std::vector<std::string>& extra_cpp1_,
6544+
std::vector<std::string>& extra_build_,
6545+
std::string_view filename_
65336546
)
6534-
: errors{ errors_ }
6535-
, includes{ includes_ }
6536-
, parse_tree{std::make_unique<translation_unit_node>()}
6547+
: errors { errors_ }
6548+
, includes { includes_ }
6549+
, extra_cpp1 { extra_cpp1_ }
6550+
, extra_build{ extra_build_ }
6551+
, filename { filename_ }
6552+
, parse_tree {std::make_unique<translation_unit_node>()}
65376553
{ }
65386554

65396555
parser( parser const& that )
65406556
: errors{ that.errors }
65416557
, includes{ that.includes }
6558+
, extra_cpp1{ that.extra_cpp1 }
6559+
, extra_build{ that.extra_build }
65426560
, parse_tree{std::make_unique<translation_unit_node>()}
65436561
{ }
65446562

65456563

6564+
//-----------------------------------------------------------------------
6565+
// get_filename
6566+
//
6567+
auto get_filename() const
6568+
-> std::string
6569+
{
6570+
return filename;
6571+
}
6572+
6573+
65466574
//-----------------------------------------------------------------------
65476575
// parse
65486576
//

0 commit comments

Comments
 (0)