[llvm-bugs] [Bug 33476] New: apparent c++ compiler issue compiling a throw statement

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 15 19:35:54 PDT 2017


            Bug ID: 33476
           Summary: apparent c++ compiler issue compiling a throw
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tootall79 at gmail.com
                CC: llvm-bugs at lists.llvm.org

while compiling a try block compiler cannot find the correct ctor candidate,
yet it CAN find it when compiling outside the throw line.

here are 3 lines of code, the first 2 lines compiles fine, the 3rd line gives
the error shown

                TString sBS("hello world");
                TErrPub eFU( sBS );           // no error here
                throw TErrPub( sBS );         // error here ??

the first line demonstrates the sBS, a string object, DOES have a ctor in the
TErrPub class, and the compiler finds it fine.  But if you try to construct the
exact same TErrPub instance inside a throw it can't find the ctor.  Here is the

/media/FATSD29/Houston/wkspc/free/dev/wxhSLED/main.cpp:740:9: error: no
matching constructor for initialization of 'TErrPub'
                throw TErrPub( sBS );
../../../../include/TErrPub.h:15:2: note: candidate constructor not viable:
expects an l-value for 1st argument
        TErrPub( TErrPub& EP );
../../../../include/TErrPub.h:17:2: note: candidate constructor not viable: no
known conversion from 'TErrPub' to 'TString &' for 1st argument
        TErrPub( TString& sMsg );

please advise, thanks!

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170616/9dd75d0b/attachment.html>

More information about the llvm-bugs mailing list