diff options
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/copy-initialization.cpp | 8 | ||||
-rw-r--r-- | test/SemaTemplate/class-template-spec.cpp | 11 |
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index f2c7de2fae..27e7db099d 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -3705,7 +3705,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, if (MemExpr->isArrow()) ObjectArg = new (Context) UnaryOperator(ObjectArg, UnaryOperator::Deref, ObjectArg->getType()->getAsPointerType()->getPointeeType(), - SourceLocation()); + ObjectArg->getLocStart()); CXXMethodDecl *Method = 0; if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(MemExpr->getMemberDecl())) { diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp index e380cc1ad3..a56a886f55 100644 --- a/test/SemaCXX/copy-initialization.cpp +++ b/test/SemaCXX/copy-initialization.cpp @@ -1,5 +1,4 @@ // RUN: clang -fsyntax-only -verify %s - class X { public: explicit X(const X&); @@ -15,3 +14,10 @@ void f(Y y, int *ip, float *fp) { X x3 = ip; X x4 = fp; // expected-error{{cannot initialize 'x4' with an lvalue of type 'float *'}} } + +struct foo { + void bar(); +}; + +// PR3600 +void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'struct foo' with an expression of type 'struct foo const'}} diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index db6759814b..9347bf5997 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -29,3 +29,14 @@ template<> class A<float, FLOAT>; template<> class A<FLOAT, float> { }; // expected-error{{redefinition}} template<> class A<float, int> { }; // expected-error{{redefinition}} + +template<typename T, typename U = int> class X; + +template <> class X<int, int> { int foo(); }; // #1 +template <> class X<float> { int bar(); }; // #2 + +typedef int int_type; +void testme(X<int_type> *x1, X<float, int> *x2) { + x1->foo(); // okay: refers to #1 + x2->bar(); // okay: refers to #2 +} |