Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: "is implicitly deleted because the default definition would be ill-formed:"

  1. #1

    "is implicitly deleted because the default definition would be ill-formed:"

    Hi everybody,

    while trying to construct an object of a class of mine I get this error message:

    Arduino: 1.8.8 (Windows 10), TD: 1.45, Board: "Teensy 3.5, MIDI, 120 MHz, Faster, US English"

    SkyController: In function 'void construct(Device)':
    SkyController:36: error: use of deleted function 'SkyFlash& SkyFlash:perator=(const SkyFlash&)'
    flashes[thisdevice.mpxpin_flash-1][inputsonchannel[thisdevice.mpxpin_flash-1][2]] = SkyFlash(potis[thisdevice.mpxpin-1][inputsonchannel[thisdevice.mpxpin-1][thisdevice.type]], thisdevice.teensypin_flash);




    E:\Dropbox\Paraluna\Entwicklung Skycommander\Contollerboard\Teensy\Sketches\librar ies\SkyController/SkyFlash.h:11:7: note: 'SkyFlash& SkyFlash:perator=(const SkyFlash&)' is implicitly deleted because the default definition would be ill-formed:

    class SkyFlash {


    ...\libraries\SkyController/SkyFlash.h:11:7: error: non-static reference member 'SkyPoti& SkyFlash:oti', can't use default assignment operator

    SkyController: In function 'void setup()':
    SkyController:51: warning: unused variable 'devices'
    Device devices[numberofdevices];


    use of deleted function 'SkyFlash& SkyFlash:perator=(const SkyFlash&)'
    There seems to be a problem with the default Constructor of my Class. But unfortunately I don't get it.

    This is the header:

    #ifndef SkyFlash_h
    #define SkyFlash_h
    #include "Arduino.h"
    #include "SkyPoti.h"
    #include "Bounce.h"
    class SkyFlash {
    	SkyFlash(SkyPoti& Poti, int pin);
        void send();
    	SkyPoti& poti;
    	Bounce bounce;

    #include "Arduino.h"
    #include "SkyFlash.h"
    #include "SkyPoti.h"
    #include "Bounce.h"
    SkyPoti defaultpoti;
    //default Constructor
    SkyFlash::SkyFlash(): poti(defaultpoti), bounce(0, 0) {
    SkyFlash::SkyFlash(SkyPoti& Poti, int pin) : poti(Poti), bounce(pin, 10) {
    	pinMode(pin, INPUT_PULLUP);
    SkyFlash::~Skyflash() {
    //flash that thing!
    void SkyFlash::send() {
    	if (bounce.fallingEdge()) {
    	}	else  if (bounce.risingEdge()) {
    Attached you'll find the whole code including ino and library.

    Thank you in advance, I'm sorry for all that code, but I don't know how I could provide a simpler example of this problem.
    Attached Files Attached Files

  2. #2
    The default operator=() is deleted because you have reference as a member (SkyPito& poti). Either write your code so that it doesn't require operator=() or change the member to pointer for example. You just need to make sure that even in that case the default copy behavior is correct (e.g. you don't double-delete poti upon destruction, etc.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts