@@ -167,7 +167,7 @@ struct primary_expression_node
167
167
auto is_literal () const
168
168
-> bool;
169
169
170
- auto template_arguments () const -> std::vector<template_argument>&;
170
+ auto template_arguments () const -> std::vector<template_argument> const &;
171
171
172
172
auto get_token () const -> token const *;
173
173
@@ -1024,11 +1024,10 @@ struct template_argument
1024
1024
1025
1025
auto to_string () const
1026
1026
-> 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;
1030
1027
};
1031
1028
1029
+ // Used by functions that must return a reference to an empty arg list
1030
+ inline std::vector<template_argument> const no_template_args;
1032
1031
1033
1032
struct unqualified_id_node
1034
1033
{
@@ -1040,8 +1039,8 @@ struct unqualified_id_node
1040
1039
1041
1040
std::vector<template_argument> template_args;
1042
1041
1043
- auto template_arguments ()
1044
- -> std::vector<template_argument>&
1042
+ auto template_arguments () const
1043
+ -> std::vector<template_argument> const &
1045
1044
{
1046
1045
return template_args;
1047
1046
}
@@ -1104,7 +1103,7 @@ struct qualified_id_node
1104
1103
std::vector<term> ids;
1105
1104
1106
1105
auto template_arguments () const
1107
- -> std::vector<template_argument>&
1106
+ -> std::vector<template_argument> const &
1108
1107
{
1109
1108
return ids.back ().id ->template_arguments ();
1110
1109
}
@@ -1223,7 +1222,7 @@ struct type_id_node
1223
1222
}
1224
1223
1225
1224
auto template_arguments () const
1226
- -> std::vector<template_argument>&
1225
+ -> std::vector<template_argument> const &
1227
1226
{
1228
1227
if (id.index () == unqualified) {
1229
1228
return std::get<unqualified>(id)->template_arguments ();
@@ -1467,7 +1466,7 @@ struct id_expression_node
1467
1466
> id;
1468
1467
1469
1468
auto template_arguments () const
1470
- -> std::vector<template_argument>&
1469
+ -> std::vector<template_argument> const &
1471
1470
{
1472
1471
if (is_unqualified ()) {
1473
1472
return std::get<unqualified>(id)->template_arguments ();
@@ -3691,13 +3690,13 @@ auto function_type_node::is_destructor() const
3691
3690
3692
3691
3693
3692
auto primary_expression_node::template_arguments () const
3694
- -> std::vector<template_argument>&
3693
+ -> std::vector<template_argument> const &
3695
3694
{
3696
3695
if (expr.index () == id_expression) {
3697
3696
return std::get<id_expression>(expr)->template_arguments ();
3698
3697
}
3699
3698
// else
3700
- return template_argument:: no_template_args;
3699
+ return no_template_args;
3701
3700
}
3702
3701
3703
3702
0 commit comments