Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Feb 9, 2018
1 parent fdd69fa commit c0e1824
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Clara v1.1.1
# Clara v1.1.2
[![Build Status](https://travis-ci.org/catchorg/Clara.svg?branch=master)](https://travis-ci.org/catchorg/Clara)
[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Clara?brach=master&svg=true)](https://ci.appveyor.com/project/catchorg/clara)
[![codecov](https://codecov.io/gh/catchorg/Clara/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Clara)
Expand Down
9 changes: 9 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<a id="top"></a>

# 1.1.2
* Fix usage of `dynamic_cast` preventing Clara being used with `-fno-rtti`


# Older versions (1.1.1 and earlier)

No release notes have been kept (Maybe some of it will be backfilled later)
2 changes: 1 addition & 1 deletion include/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// See https://github.com/philsquared/Clara for more details

// Clara v1.1.1
// Clara v1.1.2

#ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED
Expand Down
10 changes: 6 additions & 4 deletions single_include/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// See https://github.com/philsquared/Clara for more details

// Clara v1.1.1
// Clara v1.1.2

#ifndef CLARA_HPP_INCLUDED
#define CLARA_HPP_INCLUDED
Expand Down Expand Up @@ -670,12 +670,14 @@ namespace detail {
struct BoundRef : NonCopyable {
virtual ~BoundRef() = default;
virtual auto isContainer() const -> bool { return false; }
virtual auto isFlag() const -> bool { return false; }
};
struct BoundValueRefBase : BoundRef {
virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
};
struct BoundFlagRefBase : BoundRef {
virtual auto setFlag( bool flag ) -> ParserResult = 0;
virtual auto isFlag() const -> bool { return true; }
};

template<typename T>
Expand Down Expand Up @@ -907,7 +909,7 @@ namespace detail {
if( token.type != TokenType::Argument )
return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );

assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
assert( !m_ref->isFlag() );
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );

auto result = valueRef->setValue( remainingTokens->token );
Expand Down Expand Up @@ -983,14 +985,14 @@ namespace detail {
if( remainingTokens && remainingTokens->type == TokenType::Option ) {
auto const &token = *remainingTokens;
if( isMatch(token.token ) ) {
if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
if( m_ref->isFlag() ) {
auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );
auto result = flagRef->setFlag( true );
if( !result )
return InternalParseResult( result );
if( result.value() == ParseResultType::ShortCircuitAll )
return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
} else {
assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
++remainingTokens;
if( !remainingTokens )
Expand Down

0 comments on commit c0e1824

Please sign in to comment.