Arduino 1.5.7 - error: using temporary as lvalue [-fpermissive]

Hello, I'm trying to compile the exaple sketch "Simple Clock" from Blinkenlight dcf77 library using Arduino IDE 1.5.7.

When I compile I've this error:

Arduino:1.5.7 (Windows XP), Scheda:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp: In function 'void DCF77_Frequency_Control::process_1_Hz_tick(const DCF77::time_data_t&)':
C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp:2971:70: error: using temporary as lvalue [-fpermissive]
             ((DCF77::time_data_t)decoded_time).leap_second_scheduled = true;
                                                                      ^
C:\Documents and Settings\STEFANOD\Documenti\Arduino\libraries\dcf77_library\dcf77.cpp:2979:70: error: using temporary as lvalue [-fpermissive]
             ((DCF77::time_data_t)decoded_time).leap_second_scheduled = leap_second_scheduled;
                                                                      ^

If I add -fpermissive compiler flag gcc crash (Issue #2336).

This is the function that cause this error:

void process_1_Hz_tick(const DCF77::time_data_t &decoded_time) {
    const int16_t deviation_to_trigger_readjust = 5;

    deviation = compute_phase_deviation(decoded_time.second, decoded_time.minute.digit.lo);

    if (decoded_time.second == calibration_second) {
        const bool leap_second_scheduled = decoded_time.leap_second_scheduled;
        // This is dirty: we overwrite a constant. This will only
        // work because we are in an interrupt and will not be interrupted.
        // We restore the constant immediately after the check.
        // Unfortunately this is necessary because we might be
        // in an unqualified state and thus the leap second information may be wrong.
        // However if we fail to detect this calibration will be wrong by
        // 1 second.
        ((DCF77::time_data_t)decoded_time).leap_second_scheduled = true;
        if (DCF77_Encoder::verify_leap_second_scheduled(decoded_time)) {
            // Leap seconds will mess up our frequency computations.
            // Handling them properly would be slightly more complicated.
            // Since leap seconds may only happen every 3 months we just
            // stop calibration for leap seconds and do nothing else.
            calibration_state.running = false;
        }
        ((DCF77::time_data_t)decoded_time).leap_second_scheduled = leap_second_scheduled;

        if (calibration_state.running) {
            if (calibration_state.qualified) {
                if ((elapsed_minutes >= tau_min_minutes && abs(deviation) >= deviation_to_trigger_readjust) ||
                elapsed_minutes >= tau_max_minutes) {
                    adjust();

                     // enqueue write to eeprom
                    data_pending = true;
                    // restart calibration next second
                    calibration_state.running = false;
                }
            } else {
                // unqualified
                if (elapsed_minutes >= tau_max_minutes) {
                    // running unqualified for more than tau minutes
                    //   --> the current calibration attempt is doomed
                    calibration_state.running = false;
                }
                // else running but unqualified --> wait for better state
            }
        } else {
            // (calibration_state.running == false) --> waiting
            if (calibration_state.qualified) {
                elapsed_centiseconds_mod_60000 = 0;
                elapsed_minutes = 0;
                start_minute_mod_10 = decoded_time.minute.digit.lo;
                calibration_state.running = true;
            }
            // else waiting but unqualified --> nothing to do
        }
    }
}

I can't find a way to fix... Some ideas?

Why the cast:

((DCF77::time_data_t)decoded_time).leap_second_scheduled = true;

You have a reference, then you cast it to a value. A temporary is created, and they are const, you can't write to it!

Why not just access it below ( apart from the reference, the cast type is the same type! )

decoded_time.leap_second_scheduled = true;

But wait, oops, you have not remembered you declared the parameter as 'const':

void process_1_Hz_tick(const DCF77::time_data_t &decoded_time) {

Why did you pass it as a constant if your code needs to modify it?

Hi!

I'm not the developer of dcf77 library that cause this problem.... I'm only looking for a way to fix it.... :~

The library don't work using gcc bundled in 1.0.6 IDE. It is tested using gcc 4.5.3. Before to setup a non standard installation changing gcc version, I want to try to make it work using gcc of 1.5.7 ide.

This code construct is too difficult for my c++ skill... :(