Ignore:
Timestamp:
May 23, 2019, 5:06:30 PM (6 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f1ec88a
Parents:
3ca912a
Message:

Translation can go both ways without crashing. Don't seem to be the inverse of each other.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/include/cassert

    r3ca912a rf685679  
    99// Author           : Peter A. Buhr
    1010// Created On       : Thu Aug 18 13:19:26 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug  1 11:56:01 2017
    13 // Update Count     : 16
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu May 23 15:30:00 2017
     13// Update Count     : 17
    1414//
    1515
     
    4343#endif
    4444
    45 template<typename T, typename U>
    46 static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) {
     45enum StrictAllowNull {NonNull, AllowNull};
     46
     47template<typename T, StrictAllowNull nullable = NonNull, typename U>
     48static inline T strict_dynamic_cast( const U & src ) {
     49        if (nullable == AllowNull && src == nullptr) {
     50                return nullptr;
     51        }
    4752        assert(src);
    4853        T ret = dynamic_cast<T>(src);
Note: See TracChangeset for help on using the changeset viewer.