# Error: C++ Default parameter not parsed: "nullptr"

**URL:** <https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328>\
**Category:** UI\
**Tags:** interface, default, parameter, unreal-engine, question\
**Created:** [February 18, 2017, 8:19am UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328 "2017-02-18T08:19:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 18, 2017, 8:19am UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/1 "2017-02-18T08:19:57Z")

</div>

I have a `UFUNCTION` that takes in a type of `TScriptableInterface` as one of its parameters. In the header, I have default values set for everything so when called in blueprint the function node has the defaults auto-filled. The compiler is throwing fits about object types not having a default value when the primitives do, so I want to set it to `nullptr` just to make it happy. This works for class types `AActor actor = nullptr`, but not for `TScriptableInterface` for some reason. Is there another null type I can set it to?

```
UFUNCTION(BlueprintCallable, Category="BuffComponent")
 virtual void Initialize(
    float _timeCreated = 0.0, 
    float _lifeSpan = 6.0, 
    float _tickRate = 1.0, 
    bool _bIsExpirable = true, 
    TScriptInterface<class IBuffableInterface> _owner = nullptr
 );

Error: C++ Default parameter not parsed: _owner "nullptr"

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 18, 2017, 8:38am UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/2 "2017-02-18T08:38:35Z")

</div>

What hasn’t worked so far.

`Error: C++ Default parameter not parsed: _owner "UObjectPtr"`

`Error: C++ Default parameter not parsed: _owner "this'`

`Error: C++ Default parameter not parsed: _owner "TScriptInterface>class IBuffableInterface>()"`

`Error: C++ Default parameter not parsed: _owner "(IBuffableInterface*)nullptr"`

😕

---

<div class="post-metadata">

**Author:** ![Wurmloch83](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wurmloch83](https://forums.unrealengine.com/u/Wurmloch83)\
**Post date:** [February 18, 2017, 11:06am UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/3 "2017-02-18T11:06:13Z")

</div>

`TScriptInterface` is not a pointer type.

Can you use `TScriptInterface* _owner = nullptr` instead?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 18, 2017, 7:28pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/4 "2017-02-18T19:28:55Z")

</div>

`( ..., TScriptInterface *_owner = nullptr );`

` Error: Missing '<' in TScriptInterface`

I read somewhere that TScriptInterface is a smart pointer. I’m not entirely sure what the key differences are.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 18, 2017, 7:31pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/5 "2017-02-18T19:31:51Z")

</div>

> **[How to have interface type as UPROPERTY?](https://forums.unrealengine.com/questions/215769/how-to-have-interface-type-as-uproperty.html)**
>
> How do I use an interface type as a UPROPERTY in c++? For example, in Blueprint the function GetAllActorsWithInterface takes an interface type as an argument. How could I make a C++ class which had a UFUNCTION like this or a UPROPERTY like this? ...

---

<div class="post-metadata">

**Author:** ![Wurmloch83](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wurmloch83](https://forums.unrealengine.com/u/Wurmloch83)\
**Post date:** [February 18, 2017, 7:42pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/6 "2017-02-18T19:42:36Z")

</div>

The LT and GT signs are somehow eaten up by this website, I originally wrote `TScriptInterface&LT;class IBuffableInterface&GT;` (hopefully shown now)

But if it is a smart pointer, forget about passing it as pointer as I suggested… It may be impossible to give it default value when used as UFUNCTION parameter. The UHT is not perfect yet. May someone correct me if I am wrong.

You can at least move the problematic paramter to the first position, so you can keep the default values for the other parameters.  
Sorry that I can not help you further.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 19, 2017, 6:18pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/7 "2017-02-19T18:18:56Z")

</div>

I tried `TScriptInterface>class IBuffableInterface> *_owner`. Compiler says inappropriate use of \*, cannot have an exposed pointer to this type. And having a parameter with no default value as the first doesn’t work. Either everything has a default value or it doesn’t.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ed1c3df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ed1c3df](https://forums.unrealengine.com/u/anonymous_user_1ed1c3df)\
**Post date:** [February 20, 2017, 9:45am UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/8 "2017-02-20T09:45:47Z")

</div>

I guess this is just a case of UHT being weird. Can anyone confirm this?

---

<div class="post-metadata">

**Author:** ![callumpoole](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@callumpoole](https://forums.unrealengine.com/u/callumpoole)\
**Post date:** [March 1, 2024, 9:47pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/10 "2024-03-01T21:47:31Z")

</div>

Hello, I’m using UE5.3…  
so I had a similar issue with ‘double Tolerance = UE\_DOUBLE\_SMALL\_NUMBER’.  
the UE\_DOUBLE\_SMALL\_NUMBER macro is defined as: (1.e-8), if I instead wrote my default parameter like: ‘double Tolerance = 1.e-8’ then it worked okay, so it seems the UHT didn’t like the brackets. Just find it strange that FMath has Tolerances that use this macro and it worked fine for Epic…

I guess in relation to the original question given this info, the UHT is like TScriptInterface is a different from nullptr since it doesn’t have the C++ knowhow to see that it’s a valid value. Hope this is of some good use, even if it doesn’t show a concrete solution to the original question.

---

<div class="post-metadata">

**Author:** ![Angius](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/angius/32/465528_2.png) [@Angius](https://forums.unrealengine.com/u/Angius)\
**Post date:** [December 21, 2024, 4:54pm UTC](https://forums.unrealengine.com/t/error-c-default-parameter-not-parsed-nullptr/385328/11 "2024-12-21T16:54:42Z")

</div>

It’s not the brackets, I have a very plain value defined as a macro and it doesn’t work either.

```cpp
#define DEFAULT_MARGIN 0.0001f

UCLASS()
class MYGAME_API UFloatHelpers : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable, Category = "Float Helpers", BlueprintPure, meta=(Keywords="float, equal, eq, ==", CompactNodeTitle="≈"))
    static bool EqualWithMargin(float A, float B, float Margin = DEFAULT_MARGIN);
}

```

Doesn’t work with `#define DEFAULT_MARGIN 0.0001` either
