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

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"

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"

:confused:

TScriptInterface is not a pointer type.

Can you use TScriptInterface* _owner = nullptr instead?

( ..., 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.

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.

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.

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

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.