@@ -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
10331032struct 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 ();
@@ -3642,13 +3641,13 @@ auto function_type_node::is_destructor() const
36423641
36433642
36443643auto primary_expression_node::template_arguments () const
3645- -> std::vector<template_argument>&
3644+ -> std::vector<template_argument> const &
36463645{
36473646 if (expr.index () == id_expression) {
36483647 return std::get<id_expression>(expr)->template_arguments ();
36493648 }
36503649 // else
3651- return template_argument:: no_template_args;
3650+ return no_template_args;
36523651}
36533652
36543653
0 commit comments