shafik updated this revision to Diff 455784.
shafik added a comment.
Apply clang-format
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132712/new/
https://reviews.llvm.org/D132712
Files:
clang/lib/Sema/SemaTemplate.cpp
clang/test/SemaCXX/member-expr.cpp
Index: clang/test/SemaCXX/member-expr.cpp
===================================================================
--- clang/test/SemaCXX/member-expr.cpp
+++ clang/test/SemaCXX/member-expr.cpp
@@ -228,3 +228,19 @@
.i; // expected-error {{member reference type 'S *' is a pointer; did
you mean to use '->'}}
}
}
+
+namespace LookupTemplateNameAssert {
+void f() {}
+
+typedef int at[];
+const at& f2(){}
+
+void g() {
+ f().junk<int>(); // expected-error {{member reference base type 'void' is
not a structure or union}}
+// expected-error@-1 {{expected '(' for function-style cast or type
construction}}
+// expected-error@-2 {{expected expression}}
+ f2().junk<int>(); // expected-error {{member reference base type 'const at'
(aka 'const int[]') is not a structure or union}}
+// expected-error@-1 {{expected '(' for function-style cast or type
construction}}
+// expected-error@-2 {{expected expression}}
+}
+}
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -398,7 +398,8 @@
assert(SS.isEmpty() && "ObjectType and scope specifier cannot coexist");
LookupCtx = computeDeclContext(ObjectType);
IsDependent = !LookupCtx && ObjectType->isDependentType();
- assert((IsDependent || !ObjectType->isIncompleteType() ||
+ assert((IsDependent || !ObjectType->getAs<TagType>() ||
+ !ObjectType->isIncompleteType() ||
ObjectType->castAs<TagType>()->isBeingDefined()) &&
"Caller should have completed object type");
Index: clang/test/SemaCXX/member-expr.cpp
===================================================================
--- clang/test/SemaCXX/member-expr.cpp
+++ clang/test/SemaCXX/member-expr.cpp
@@ -228,3 +228,19 @@
.i; // expected-error {{member reference type 'S *' is a pointer; did you mean to use '->'}}
}
}
+
+namespace LookupTemplateNameAssert {
+void f() {}
+
+typedef int at[];
+const at& f2(){}
+
+void g() {
+ f().junk<int>(); // expected-error {{member reference base type 'void' is not a structure or union}}
+// expected-error@-1 {{expected '(' for function-style cast or type construction}}
+// expected-error@-2 {{expected expression}}
+ f2().junk<int>(); // expected-error {{member reference base type 'const at' (aka 'const int[]') is not a structure or union}}
+// expected-error@-1 {{expected '(' for function-style cast or type construction}}
+// expected-error@-2 {{expected expression}}
+}
+}
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -398,7 +398,8 @@
assert(SS.isEmpty() && "ObjectType and scope specifier cannot coexist");
LookupCtx = computeDeclContext(ObjectType);
IsDependent = !LookupCtx && ObjectType->isDependentType();
- assert((IsDependent || !ObjectType->isIncompleteType() ||
+ assert((IsDependent || !ObjectType->getAs<TagType>() ||
+ !ObjectType->isIncompleteType() ||
ObjectType->castAs<TagType>()->isBeingDefined()) &&
"Caller should have completed object type");
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits