@@ -2268,6 +2268,8 @@ def _parse_function(
22682268
22692269 if (is_class_block or multiple_name_segments ) and not is_typedef :
22702270 props .update (dict .fromkeys (mods .meths .keys (), True ))
2271+ if mods .explicit_value is not None :
2272+ props ["explicit" ] = mods .explicit_value
22712273
22722274 if attributes is None :
22732275 attributes = []
@@ -2562,6 +2564,7 @@ def _parse_type(
25622564 vars : typing .Dict [str , LexToken ] = {} # only found on variables
25632565 both : typing .Dict [str , LexToken ] = {} # found on either
25642566 meths : typing .Dict [str , LexToken ] = {} # only found on methods
2567+ explicit_value : typing .Optional [Value ] = None
25652568
25662569 get_token = self .lex .token
25672570
@@ -2601,6 +2604,13 @@ def _parse_type(
26012604 both [tok_type ] = tok
26022605 elif tok_type in self ._type_kwd_meth :
26032606 meths [tok_type ] = tok
2607+ if tok_type == "explicit" :
2608+ # C++20: explicit(<bool-constant-expression>)
2609+ otok = self .lex .token_if ("(" )
2610+ if otok :
2611+ explicit_value = self ._create_value (
2612+ self ._consume_balanced_tokens (otok )[1 :- 1 ]
2613+ )
26042614 elif tok_type == "mutable" :
26052615 vars ["mutable" ] = tok
26062616 elif tok_type == "volatile" :
@@ -2625,7 +2635,7 @@ def _parse_type(
26252635 self .lex .return_token (tok )
26262636
26272637 # Always return the modifiers
2628- mods = ParsedTypeModifiers (vars , both , meths )
2638+ mods = ParsedTypeModifiers (vars , both , meths , explicit_value )
26292639 return parsed_type , mods
26302640
26312641 def _parse_decl (
0 commit comments