Skip to content

Commit 5b7eeb2

Browse files
author
Fytch
committed
relax assertions in .type, .single, .multi so that they may be invoked late if the arguments agree with the previous
1 parent 3de175f commit 5b7eeb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ProgramOptions.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ namespace po {
15281528

15291529
public:
15301530
option& type( value_type type ) {
1531-
PROGRAMOPTIONS_ASSERT( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty(),
1531+
PROGRAMOPTIONS_ASSERT( ( m_type == type ) || ( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty() ),
15321532
"type() must be set prior to: fallback(), callback(), parsing" );
15331533
PROGRAMOPTIONS_ASSERT( valid_type( type ), "type: invalid value_type" );
15341534
mutable_operation();
@@ -1540,14 +1540,14 @@ namespace po {
15401540
}
15411541

15421542
option& single() {
1543-
PROGRAMOPTIONS_ASSERT( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty(),
1543+
PROGRAMOPTIONS_ASSERT( ( m_multi == false ) || ( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty() ),
15441544
"single() must be set prior to: fallback(), callback(), parsing" );
15451545
mutable_operation();
15461546
m_multi = false;
15471547
return *this;
15481548
}
15491549
option& multi() {
1550-
PROGRAMOPTIONS_ASSERT( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty(),
1550+
PROGRAMOPTIONS_ASSERT( ( m_multi == true ) || ( m_fallback == nullptr && m_data == nullptr && m_callbacks.empty() ),
15511551
"multi() must be set prior to: fallback(), callback(), parsing" );
15521552
mutable_operation();
15531553
m_multi = true;

0 commit comments

Comments
 (0)