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++/59621] New: wrong caret / lineno for wrong ctor field initializer


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

            Bug ID: 59621
           Summary: wrong caret / lineno for wrong ctor field initializer
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
                CC: dodji at gcc dot gnu.org
            Target: x86_64-unknown-linux-gnu

class C {
public:
  void *ap,*bp;
  C(int i,void *p):ap(i)
  ,bp(p)
  {}
};

g++ -c cxxctor.C -Wall -g

FAIL: gcc (GCC) 4.8.3 20131023 (prerelease)
FAIL: gcc (GCC) 4.9.0 20131119 (experimental)
FAIL: gcc-c++-4.8.2-7.fc19.x86_64
cxxctor.C: In constructor âC::C(int, void*)â:
cxxctor.C:5:8: error: invalid conversion from âintâ to âvoid*â [-fpermissive]
   ,bp(p)
        ^

PASS: clang-3.3-3.fc19.x86_64
cxxctor.C:4:20: error: cannot initialize a member subobject of type 'void *'
with an lvalue of type 'int'
  C(int i,void *p):ap(i)
                   ^  ~
1 error generated.

The error may be really confusing for many non-trivial ctor parameters.

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