ChatGPT spitting out JUCE code

Out of curiosity, I gave ChatGPT (AI that can respond to queries) the following prompt :
“please give me the JUCE C++ Code to host a VST3 plugin.”. Here’s a screenshot of its response, as well as the code (yet to try).

Code:

#include "../JuceLibraryCode/JuceHeader.h"
#include "Vst3PluginFormat.h"

// This example assumes that you have a VST3 plugin with the class name "MyVST3Plugin"
// located in a binary file called "MyVST3Plugin.vst3"

class VST3Host : public AudioAppComponent
{
public:
    VST3Host()
    {
        // Initialize the VST3 plugin format manager
        vst3PluginFormatManager.addDefaultFormats();

        // Load the VST3 plugin
        File vst3PluginFile ("MyVST3Plugin.vst3");
        KnownPluginList::addToBlacklist (vst3PluginFile);
        pluginInstance = vst3PluginFormatManager.createPluginInstance (vst3PluginFile, getSampleRate());

        // Set the plugin's preset
        pluginInstance->setCurrentProgram (0);

        // Set the plugin's number of channels
        pluginInstance->setPlayConfigDetails (2, 2, getSampleRate(), getBlockSize());

        // Set the plugin's editor to visible
        pluginInstance->setEditorState (true);

        // Set the plugin's sample rate and block size
        pluginInstance->setSampleRate (getSampleRate());
        pluginInstance->setBlockSize (getBlockSize());
    }

    ~VST3Host() override
    {
        // Release the plugin instance
        pluginInstance = nullptr;
    }

    void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
    {
        // Set the plugin's sample rate and block size
        pluginInstance->setSampleRate (sampleRate);
        pluginInstance->setBlockSize (samplesPerBlockExpected);
    }

    void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
    {
        // Process the audio using the VST3 plugin
        pluginInstance->processBlock (bufferToFill.buffer, bufferToFill.startSample, bufferToFill.numSamples);
    }

    void releaseResources() override {}

private:
    VST3PluginFormatManager vst3PluginFormatManager;
    AudioPluginInstance::Ptr pluginInstance;
};

// Declare the audio app and start it running
START_JUCE_APPLICATION (VST3Host)

I’ve been playing with this some more, and sometimes it works pretty well. I asked it to make me a class that returned a TextButton element, and an example of how to call the class, and the tested code worked well. I think it might be overall useful for some things.