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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to