lock3 / cppx

Extensions to Clang for Compiling the Blue & Gold Languages
29 stars 4 forks source link

Empty blocks with a new line don't compile #79

Closed bbartman closed 3 years ago

bbartman commented 3 years ago

offending code: Addendum - This is any empty block with a new line inside of it doesn't compile. in order to compile an empty block the must be on the same line.

<# Defining the new_allocator #>;

__throw_bad_alloc()<noreturn>:void

__STDCPP_DEFAULT_NEW_ALIGNMENT__<constexpr>:int = 8

__addressof[T:type](x:ref T)<inline>:^T !
  return __builtin_addressof(x)

new_allocator[T:type] : type = class:

  size_type : type = uint64
  difference_type : type = int64
  pointer : type = ^T
  const_pointer : type = ^ const T
  reference : type = ref T
  const_reference : type = ref const T

  rebind[T1:type] : type = class { other : type = new_allocator[T1]; }

  constructor()<noexcept>! { }
  constructor(other:ref const new_allocator[T])<noexcept>! { }
  destructor()<noexcept>! { }

  address(x : reference)<const><noexcept>:pointer! {
    return __addressof(x);
  }

  address(x : const_reference)<const><noexcept>:const_pointer! {
    return __addressof(x);
  }

  allocate(n:size_type, ignored:^const void = null): pointer !{
    if (n > this.max_size()) {
      __throw_bad_alloc();
    }
    if (alignof(T) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) {

    }

  }
sdgoodrick commented 3 years ago

fixed https://github.com/lock3/cppx/commit/9fdd7aee837ead8b5c3a59d3d7e90d42aeed35b0