This problem originates in peren_c++. The test (Sec13/3_1_3/P13290.C)
exercising the following clause: ISO/IEC 14882:1998, 13.3.1.3. 
(When a user-defined conversion is invoked to convert an
 assignment-expression to a type cv T, where T is a class type,
 a constructor of T is considered a candidate function by
 overload resolution.)

Simplified test case is: 

#include <stdio.h>

int counter = 0;

struct S {
        int m;

        S(int i=0) : m(i) { counter++; }
};


main(){

   counter = 0;

        S s00 = 1;

   fprintf(stderr,"counter = (%d)\n",counter);

   counter = 0;

        volatile S s02 = 1;

   fprintf(stderr,"volatile counter = (%d)\n",counter);

}

to compile: g++ P13290_short.C
The error massage is:

P13290_short.C: In function ?int main()?:
P13290_short.C:23: error: no matching function for call to ?S::S(volatile S)?
P13290_short.C:9: note: candidates are: S::S(int)
P13290_short.C:6: note:                 S::S(const S&)

It will also fail for "const volatile S s02 = 1;"

It is passing with 3.4.6 but fails on 4.3.2 and 4.4.0. The 4.4.0 platform is
plain vanilla x86 (x86_64-unknown-linux-gnu). I got it just to verify the issue
so you can refer to a supported platform. Thanks.


-- 
           Summary: Fail to use constructor to initialize volatile
                    declaration (no matching function for call)
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sergei_lus at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39982

Reply via email to