static constexpr T t = 0x8000;
std::string s;
void f(char c) { s += c | static_cast<int>(t); }
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: an integer is interpreted as a chara
- // CHECK-FIXES: {{^}} void f(char c) { s += std::to_string(c | static_cast<int>(t)); }
};
template S<int>;
template <class>
class d {
a e;
- void f() { e.b(0); }
+ void f() { e.b(); }
};
} // namespace
} // namespace PR38055
MemberExpr *E = new (Mem) MemberExpr(Base, IsArrow, OperatorLoc, MemberDecl,
NameInfo, T, VK, OK, NOUR);
- if (FieldDecl *Field = dyn_cast<FieldDecl>(MemberDecl)) {
- DeclContext *DC = MemberDecl->getDeclContext();
- // dyn_cast_or_null is used to handle objC variables which do not
- // have a declaration context.
- CXXRecordDecl *RD = dyn_cast_or_null<CXXRecordDecl>(DC);
- if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
- E->setTypeDependent(T->isDependentType());
- }
-
if (HasQualOrFound) {
// FIXME: Wrong. We should be looking at the member declaration we found.
if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent()) {
bool AnyIsPacked = false;
do {
QualType BaseType = ME->getBase()->getType();
- if (BaseType->isDependentType())
- return;
if (ME->isArrow())
BaseType = BaseType->getPointeeType();
RecordDecl *RD = BaseType->castAs<RecordType>()->getDecl();
[[nodiscard]] void *operator new(std::size_t, std::align_val_t, const std::nothrow_t&) noexcept;
[[nodiscard]] void *operator new[](std::size_t, const std::nothrow_t&) noexcept;
[[nodiscard]] void *operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) noexcept;
-[[nodiscard]] void *operator new[](std::size_t, std::align_val_t);
void operator delete(void*, const std::nothrow_t&) noexcept;
void operator delete(void*, std::align_val_t, const std::nothrow_t&) noexcept;
void operator delete[](void*, const std::nothrow_t&) noexcept;
// Ensure that we don't try to evaluate these for overflow and crash. These
// are all value-dependent expressions.
p = new char[n];
- p = new ((std::align_val_t)n) char[n];
+ p = new (n) char[n];
p = new char(n);
}
}
}
int e[10];
};
+ void g() {
+ S<int>().f(); // expected-note {{here}}
+ }
}
namespace A2 {
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
enum Enum { val = 1 };
template <Enum v> struct C {
unsigned long long bitfield : e0;
void f(int j) {
- bitfield + j; // expected-warning {{expression result unused}}
+ bitfield + j;
}
};
}
void get(B **ptr) {
// It's okay if at some point we figure out how to diagnose this
// at instantiation time.
- *ptr = field; // expected-error {{assigning to 'test6::B *' from incompatible type 'test6::A *}}
+ *ptr = field;
}
};
}
+++ /dev/null
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-struct NOT_AN_INTEGRAL_TYPE {};
-
-template <typename T>
-struct foo {
- NOT_AN_INTEGRAL_TYPE Bad;
- void run() {
- switch (Bad) { // expected-error {{statement requires expression of integer type ('NOT_AN_INTEGRAL_TYPE' invalid)}}
- case 0:
- break;
- }
- }
-};