This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36769] New: implicit conversion do not work


Have to take place implicit convesion type1 to type2 to sss in function main()
in string:
 sss xxx = x;
But it works (workaround?) for only the following syntax:
 sss xxx( x );

All addition info follows (test4.ii includes all source required):

jia3ep@zork:~/test$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

jia3ep@zork:~/test$ uname -a
Linux zork.elvees.com 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686
GNU/Linux

jia3ep@zork:~/test$ g++ test4.cpp -save-temps
test4.cpp: In function 'int main()':
test4.cpp:16: error: conversion from 'type1' to non-scalar type 'sss' requested

jia3ep@zork:~/test$ cat test4.ii
# 1 "test4.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test4.cpp"
struct type1 {
  type1() {};
};

struct type2 {
 type2( const type1& ) {};
};

struct sss {
  sss( type2 ) {
 };
};

int main() {
 type1 x;
 sss xxx = x;

 return 0;
}


-- 
           Summary: implicit conversion do not work
           Product: gcc
           Version: 4.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jia3ep at gmail dot com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]