Skip to content

Commit 874fa8d

Browse files
committed
2 parents ca42e2c + efd185f commit 874fa8d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

source/parse.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct primary_expression_node
167167
auto is_literal() const
168168
-> bool;
169169

170-
auto template_arguments() const -> std::vector<template_argument>&;
170+
auto template_arguments() const -> std::vector<template_argument> const&;
171171

172172
auto get_token() const -> token const*;
173173

@@ -1024,11 +1024,10 @@ struct template_argument
10241024

10251025
auto to_string() const
10261026
-> std::string;
1027-
1028-
// So that template_arguments() accessors can return a reference to an empty arg list
1029-
static inline std::vector<template_argument> no_template_args;
10301027
};
10311028

1029+
// Used by functions that must return a reference to an empty arg list
1030+
inline std::vector<template_argument> const no_template_args;
10321031

10331032
struct unqualified_id_node
10341033
{
@@ -1040,8 +1039,8 @@ struct unqualified_id_node
10401039

10411040
std::vector<template_argument> template_args;
10421041

1043-
auto template_arguments()
1044-
-> std::vector<template_argument>&
1042+
auto template_arguments() const
1043+
-> std::vector<template_argument> const&
10451044
{
10461045
return template_args;
10471046
}
@@ -1104,7 +1103,7 @@ struct qualified_id_node
11041103
std::vector<term> ids;
11051104

11061105
auto template_arguments() const
1107-
-> std::vector<template_argument>&
1106+
-> std::vector<template_argument> const&
11081107
{
11091108
return ids.back().id->template_arguments();
11101109
}
@@ -1223,7 +1222,7 @@ struct type_id_node
12231222
}
12241223

12251224
auto template_arguments() const
1226-
-> std::vector<template_argument>&
1225+
-> std::vector<template_argument> const&
12271226
{
12281227
if (id.index() == unqualified) {
12291228
return std::get<unqualified>(id)->template_arguments();
@@ -1467,7 +1466,7 @@ struct id_expression_node
14671466
> id;
14681467

14691468
auto template_arguments() const
1470-
-> std::vector<template_argument>&
1469+
-> std::vector<template_argument> const&
14711470
{
14721471
if (is_unqualified()) {
14731472
return std::get<unqualified>(id)->template_arguments();
@@ -3691,13 +3690,13 @@ auto function_type_node::is_destructor() const
36913690

36923691

36933692
auto primary_expression_node::template_arguments() const
3694-
-> std::vector<template_argument>&
3693+
-> std::vector<template_argument> const&
36953694
{
36963695
if (expr.index() == id_expression) {
36973696
return std::get<id_expression>(expr)->template_arguments();
36983697
}
36993698
// else
3700-
return template_argument::no_template_args;
3699+
return no_template_args;
37013700
}
37023701

37033702

0 commit comments

Comments
 (0)