[LLVMbugs] [Bug 20911] New: Clang asserts when checked for overloaded binary operator supplied with a default argument

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 11 11:48:40 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20911

            Bug ID: 20911
           Summary: Clang asserts when checked for overloaded binary
                    operator supplied with a default argument
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sgundapa at codeaurora.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13022
  --> http://llvm.org/bugs/attachment.cgi?id=13022&action=edit
unit test case

I have attached the pre-processed test case for your reference. 
Sample compilation line 
clang++ -target arm-none-linux-gnueabi -mcpu=cortex-a9 -O2  test.ii -c

clang-3.6:
/prj/llvm-arm/home/nightly/src/community-mainline/llvm/tools/clang/include/clang/AST/Expr.h:134:
void clang::Expr::setType(clang::QualType): Assertion `(t.isNull() ||
!t->isReferenceType()) && "Expressions can't have reference type"' failed.



The original test case is supposed to generate an error as per C++ standard
since operator+ can not have default arguments. 

g++ -c test.ii generated the following diagnostic
test.c:7:30: error: 's' was not declared in this scope
 Sam operator+(Sam &x, Sam &y=s); 
                              ^
test.c:7:31: error: 'Sam operator+(Sam&, Sam&)' cannot have default arguments
 Sam operator+(Sam &x, Sam &y=s); 
                               ^
test.c: In function 'Sam operator+(Sam&, Sam&)':
test.c:10:12: error: could not convert '(x.Sam::i + y.Sam::i)' from 'int' to
'Sam'
  return x.i+y.i;

-- 
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/20140911/6be4f47e/attachment.html>


More information about the llvm-bugs mailing list