if (DiagD->isReferenced()) {
if (isa<CXXMethodDecl>(DiagD))
Diag(DiagD->getLocation(), diag::warn_unneeded_member_function)
- << DiagD->getDeclName();
+ << DiagD;
else {
if (FD->getStorageClass() == SC_Static &&
!FD->isInlineSpecified() &&
SourceMgr.getExpansionLoc(FD->getLocation())))
Diag(DiagD->getLocation(),
diag::warn_unneeded_static_internal_decl)
- << DiagD->getDeclName();
+ << DiagD;
else
Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl)
- << /*function*/0 << DiagD->getDeclName();
+ << /*function*/ 0 << DiagD;
}
} else {
if (FD->getDescribedFunctionTemplate())
Diag(DiagD->getLocation(), diag::warn_unused_template)
- << /*function*/0 << DiagD->getDeclName();
+ << /*function*/ 0 << DiagD;
else
- Diag(DiagD->getLocation(),
- isa<CXXMethodDecl>(DiagD) ? diag::warn_unused_member_function
+ Diag(DiagD->getLocation(), isa<CXXMethodDecl>(DiagD)
+ ? diag::warn_unused_member_function
: diag::warn_unused_function)
- << DiagD->getDeclName();
+ << DiagD;
}
} else {
const VarDecl *DiagD = cast<VarDecl>(*I)->getDefinition();
DiagD = cast<VarDecl>(*I);
if (DiagD->isReferenced()) {
Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl)
- << /*variable*/1 << DiagD->getDeclName();
+ << /*variable*/ 1 << DiagD;
} else if (DiagD->getType().isConstQualified()) {
const SourceManager &SM = SourceMgr;
if (SM.getMainFileID() != SM.getFileID(DiagD->getLocation()) ||
!PP.getLangOpts().IsHeaderFile)
Diag(DiagD->getLocation(), diag::warn_unused_const_variable)
- << DiagD->getDeclName();
+ << DiagD;
} else {
if (DiagD->getDescribedVarTemplate())
Diag(DiagD->getLocation(), diag::warn_unused_template)
- << /*variable*/1 << DiagD->getDeclName();
+ << /*variable*/ 1 << DiagD;
else
- Diag(DiagD->getLocation(), diag::warn_unused_variable)
- << DiagD->getDeclName();
+ Diag(DiagD->getLocation(), diag::warn_unused_variable) << DiagD;
}
}
}
if (RecFrom && RecTo) {
auto DeclFrom = RecFrom->getAsCXXRecordDecl();
if (!DeclFrom->isCompleteDefinition())
- S.Diag(DeclFrom->getLocation(), diag::note_type_incomplete)
- << DeclFrom->getDeclName();
+ S.Diag(DeclFrom->getLocation(), diag::note_type_incomplete) << DeclFrom;
auto DeclTo = RecTo->getAsCXXRecordDecl();
if (!DeclTo->isCompleteDefinition())
- S.Diag(DeclTo->getLocation(), diag::note_type_incomplete)
- << DeclTo->getDeclName();
+ S.Diag(DeclTo->getLocation(), diag::note_type_incomplete) << DeclTo;
}
}
}
if (ND)
DiagRuntimeBehavior(ND->getBeginLoc(), BaseExpr,
- PDiag(diag::note_array_declared_here)
- << ND->getDeclName());
+ PDiag(diag::note_array_declared_here) << ND);
}
void Sema::CheckArrayAccess(const Expr *expr) {
else
Diagnose = L->getStmt() == nullptr;
if (Diagnose)
- S.Diag(L->getLocation(), diag::err_undeclared_label_use) <<L->getDeclName();
+ S.Diag(L->getLocation(), diag::err_undeclared_label_use) << L;
}
void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
<< FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
else if (NewVD->hasLocalStorage())
Diag(NewVD->getLocation(), diag::err_module_private_local)
- << 0 << NewVD->getDeclName()
- << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
- << FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
+ << 0 << NewVD
+ << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
+ << FixItHint::CreateRemoval(
+ D.getDeclSpec().getModulePrivateSpecLoc());
else {
NewVD->setModulePrivate();
if (NewTemplate)
!Context.getTargetInfo().getCXXABI().isMicrosoft()) {
Diag(Var->getLocation(),
diag::err_constexpr_static_mem_var_requires_init)
- << Var->getDeclName();
+ << Var;
Var->setInvalidDecl();
return;
}
// definitions with reference type.
if (Type->isReferenceType()) {
Diag(Var->getLocation(), diag::err_reference_var_requires_init)
- << Var->getDeclName()
- << SourceRange(Var->getLocation(), Var->getLocation());
+ << Var << SourceRange(Var->getLocation(), Var->getLocation());
Var->setInvalidDecl();
return;
}
}
if (Error != -1) {
Diag(VD->getOuterLocStart(), diag::err_for_range_storage_class)
- << VD->getDeclName() << Error;
+ << VD << Error;
D->setInvalidDecl();
}
}
if (D.getDeclSpec().isModulePrivateSpecified())
Diag(New->getLocation(), diag::err_module_private_local)
- << 1 << New->getDeclName()
- << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
- << FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
+ << 1 << New << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
+ << FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
if (New->hasAttr<BlocksAttr>()) {
Diag(New->getLocation(), diag::err_block_on_nonlocal);
if (!ReturnTy->isDependentType() && ReturnTy.isPODType(Context)) {
unsigned Size = Context.getTypeSizeInChars(ReturnTy).getQuantity();
if (Size > LangOpts.NumLargeByValueCopy)
- Diag(D->getLocation(), diag::warn_return_value_size)
- << D->getDeclName() << Size;
+ Diag(D->getLocation(), diag::warn_return_value_size) << D << Size;
}
// Warn if any parameter is pass-by-value and larger than the specified
unsigned Size = Context.getTypeSizeInChars(T).getQuantity();
if (Size > LangOpts.NumLargeByValueCopy)
Diag(Parameter->getLocation(), diag::warn_parameter_size)
- << Parameter->getDeclName() << Size;
+ << Parameter << Size;
}
}
if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
Definition->getStorageClass() == SC_Extern)
Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
- << FD->getDeclName() << getLangOpts().CPlusPlus;
+ << FD << getLangOpts().CPlusPlus;
else
- Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
+ Diag(FD->getLocation(), diag::err_redefinition) << FD;
Diag(Definition->getLocation(), diag::note_previous_definition);
FD->setInvalidDecl();
if (D.getDeclSpec().isModulePrivateSpecified()) {
if (CurContext->isFunctionOrMethod())
Diag(NewTD->getLocation(), diag::err_module_private_local)
- << 2 << NewTD->getDeclName()
- << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
- << FixItHint::CreateRemoval(D.getDeclSpec().getModulePrivateSpecLoc());
+ << 2 << NewTD
+ << SourceRange(D.getDeclSpec().getModulePrivateSpecLoc())
+ << FixItHint::CreateRemoval(
+ D.getDeclSpec().getModulePrivateSpecLoc());
else
NewTD->setModulePrivate();
}
unsigned FieldBits = isSize? S.Context.getTypeSize(FieldType)
: S.Context.getTypeAlign(FieldType);
S.Diag(Field->getLocation(),
- diag::warn_transparent_union_attribute_field_size_align)
- << isSize << Field->getDeclName() << FieldBits;
+ diag::warn_transparent_union_attribute_field_size_align)
+ << isSize << *Field << FieldBits;
unsigned FirstBits = isSize? FirstSize : FirstAlign;
S.Diag(FirstField->getLocation(),
diag::note_transparent_union_first_field_size_align)
A->getSemanticSpelling() != UnusedAttr::C2x_maybe_unused) {
const Decl *DC = cast_or_null<Decl>(S.getCurObjCLexicalContext());
if (DC && !DC->hasAttr<UnusedAttr>())
- S.Diag(Loc, diag::warn_used_but_marked_unused) << D->getDeclName();
+ S.Diag(Loc, diag::warn_used_but_marked_unused) << D;
}
}
}
return true;
}
- Diag(CallLoc,
- diag::err_use_of_default_argument_to_function_declared_later) <<
- FD << cast<CXXRecordDecl>(FD->getDeclContext())->getDeclName();
+ Diag(CallLoc, diag::err_use_of_default_argument_to_function_declared_later)
+ << FD << cast<CXXRecordDecl>(FD->getDeclContext());
Diag(UnparsedDefaultArgLocs[Param],
diag::note_default_argument_declared_here);
return true;
if (Var->getType()->isVariablyModifiedType() && IsBlock) {
if (Diagnose) {
S.Diag(Loc, diag::err_ref_vm_type);
- S.Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
}
return false;
}
if (IsBlock)
S.Diag(Loc, diag::err_ref_flexarray_type);
else
- S.Diag(Loc, diag::err_lambda_capture_flexarray_type)
- << Var->getDeclName();
- S.Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ S.Diag(Loc, diag::err_lambda_capture_flexarray_type) << Var;
+ S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
}
return false;
}
// variables; they don't support the expected semantics.
if (HasBlocksAttr && (IsLambda || isa<CapturedRegionScopeInfo>(CSI))) {
if (Diagnose) {
- S.Diag(Loc, diag::err_capture_block_variable)
- << Var->getDeclName() << !IsLambda;
- S.Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ S.Diag(Loc, diag::err_capture_block_variable) << Var << !IsLambda;
+ S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
}
return false;
}
if (!Invalid && !S.getLangOpts().OpenCL && CaptureType->isArrayType()) {
if (BuildAndDiagnose) {
S.Diag(Loc, diag::err_ref_array_type);
- S.Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
Invalid = true;
} else {
return false;
if (BuildAndDiagnose) {
S.Diag(Loc, diag::err_arc_autoreleasing_capture)
<< /*block*/ 0;
- S.Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ S.Diag(Var->getLocation(), diag::note_previous_decl) << Var;
Invalid = true;
} else {
return false;
if (BuildAndDiagnose) {
LambdaScopeInfo *LSI = cast<LambdaScopeInfo>(CSI);
if (LSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_None) {
- Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName();
- Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ Diag(ExprLoc, diag::err_lambda_impcap) << Var;
+ Diag(Var->getLocation(), diag::note_previous_decl) << Var;
Diag(LSI->Lambda->getBeginLoc(), diag::note_lambda_decl);
} else
diagnoseUncapturableValueReference(*this, ExprLoc, Var, DC);
// No capture-default, and this is not an explicit capture
// so cannot capture this variable.
if (BuildAndDiagnose) {
- Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName();
- Diag(Var->getLocation(), diag::note_previous_decl)
- << Var->getDeclName();
+ Diag(ExprLoc, diag::err_lambda_impcap) << Var;
+ Diag(Var->getLocation(), diag::note_previous_decl) << Var;
if (cast<LambdaScopeInfo>(CSI)->Lambda)
Diag(cast<LambdaScopeInfo>(CSI)->Lambda->getBeginLoc(),
diag::note_lambda_decl);
}
S.Diag(Loc, diag::err_call_function_incomplete_return)
- << CE->getSourceRange() << FD->getDeclName() << T;
+ << CE->getSourceRange() << FD << T;
S.Diag(FD->getLocation(), diag::note_entity_declared_at)
<< FD->getDeclName();
}
Diag(MemExpr->getBeginLoc(),
diag::warn_call_to_pure_virtual_member_function_from_ctor_dtor)
<< MD->getDeclName() << isa<CXXDestructorDecl>(CurContext)
- << MD->getParent()->getDeclName();
+ << MD->getParent();
Diag(MD->getBeginLoc(), diag::note_previous_decl) << MD->getDeclName();
if (getLangOpts().AppleKext)
Diag(MemExpr->getBeginLoc(), diag::note_pure_qualified_call_kext)
- << MD->getParent()->getDeclName() << MD->getDeclName();
+ << MD->getParent() << MD->getDeclName();
}
}
if (FD->hasAttrs())
Attrs = &FD->getAttrs();
if (FD->isNoReturn())
- Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr)
- << FD->getDeclName();
+ Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD;
if (FD->isMain() && RetValExp)
if (isa<CXXBoolLiteralExpr>(RetValExp))
Diag(ReturnLoc, diag::warn_main_returns_bool_literal)
- << RetValExp->getSourceRange();
+ << RetValExp->getSourceRange();
if (FD->hasAttr<CmseNSEntryAttr>() && RetValExp) {
if (const auto *RT = dyn_cast<RecordType>(FnRetType.getCanonicalType())) {
if (RT->getDecl()->isOrContainsUnion())
FunctionKind = 3;
Diag(ReturnLoc, diag::err_return_init_list)
- << CurDecl->getDeclName() << FunctionKind
- << RetValExp->getSourceRange();
+ << CurDecl << FunctionKind << RetValExp->getSourceRange();
// Drop the expression.
RetValExp = nullptr;
// return of void in constructor/destructor is illegal in C++.
if (D == diag::err_ctor_dtor_returns_void) {
NamedDecl *CurDecl = getCurFunctionOrMethodDecl();
- Diag(ReturnLoc, D)
- << CurDecl->getDeclName() << isa<CXXDestructorDecl>(CurDecl)
- << RetValExp->getSourceRange();
+ Diag(ReturnLoc, D) << CurDecl << isa<CXXDestructorDecl>(CurDecl)
+ << RetValExp->getSourceRange();
}
// return (some void expression); is legal in C++.
else if (D != diag::ext_return_has_void_expr ||
FunctionKind = 3;
Diag(ReturnLoc, D)
- << CurDecl->getDeclName() << FunctionKind
- << RetValExp->getSourceRange();
+ << CurDecl << FunctionKind << RetValExp->getSourceRange();
}
}
}
template <typename T> void a3 [[noreturn]] () {}
-template <> void a3<int> () { return; } // expected-warning {{function 'a3' declared 'noreturn' should not return}}
+template <> void a3<int>() { return; } // expected-warning {{function 'a3<int>' declared 'noreturn' should not return}}
-template <typename T> void a4 [[noreturn]] () { return; } // expected-warning 2{{function 'a4' declared 'noreturn' should not return}}
+template <typename T> void a4 [[noreturn]] () { return; } // expected-warning {{function 'a4' declared 'noreturn' should not return}}
+ // expected-warning@-1 {{function 'a4<long>' declared 'noreturn' should not return}}
void a4_test() { a4<long>(); } // expected-note {{in instantiation of function template specialization 'a4<long>' requested here}}
[[noreturn, noreturn]] void b() { throw 0; } // expected-error {{attribute 'noreturn' cannot appear multiple times in an attribute specifier}}
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f(int) { } // expected-note {{previous definition is here}}
void f(const int) { } // expected-error {{redefinition of 'f'}}
+
+template <typename T> void ft(T) {}
+template <> void ft(int) {} // expected-note {{previous definition is here}}
+template <> void ft(int) {} // expected-error {{redefinition of 'ft<int>'}}
};
constexpr int operator*(const C::It &) { return 0; }
+
+ struct D {
+ D();
+ using Ty = int[2];
+ Ty *begin();
+ Ty *end();
+ };
+
+ void test_D() {
+#if __cplusplus >= 201703L
+ for (extern auto [x, y] : D()) {
+ } // expected-error@-1 {{decomposition declaration cannot be declared 'extern'}}
+ // expected-error@-2 {{loop variable '[x, y]' may not be declared 'extern'}}
+#endif
+ }
}
using X::A;
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
-template<typename T> struct X; // expected-note {{'X' is incomplete}}
+template <typename T> struct X; // expected-note {{'X<X<X<int>>>' is incomplete}}
template<int I> struct Y;
X<X<int>> *x1;
struct Z : X_int { };
void f(const X<int> x) {
- (void)reinterpret_cast<X<int>>(x); // expected-error{{reinterpret_cast from}}
- (void)reinterpret_cast<X<X<X<int>>>>(x); // expected-error{{reinterpret_cast from}}
+ (void)reinterpret_cast<X<int>>(x); // expected-error{{reinterpret_cast from 'const X<int>' to 'X<int>' is not allowed}}
+ (void)reinterpret_cast<X<X<X<int>>>>(x); // expected-error{{reinterpret_cast from 'const X<int>' to 'X<X<X<int>>>' is not allowed}}
X<X<int>> *x1;
}
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify
+// RUN: %clang_cc1 -std=c++17 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -std=c++17 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -std=c++17 -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s -verify
// FIXME: When we have a syntax for modules in C++, use that.
@import module_private_left;
void local_var_private(__module_private__ int param) { // expected-error{{parameter 'param' cannot be declared __module_private__}}
__module_private__ struct Local { int x, y; } local; //expected-error{{local variable 'local' cannot be declared __module_private__}}
+ __module_private__ auto [x, y] = local; // expected-error {{local variable '[x, y]' cannot be declared __module_private__}}
+
__module_private__ struct OtherLocal { int x; }; // expected-error{{local struct cannot be declared __module_private__}}
typedef __module_private__ int local_typedef; // expected-error{{typedef 'local_typedef' cannot be declared __module_private__}}
}
+void param_private(__module_private__ int) {} // expected-error {{parameter '' cannot be declared __module_private}}
+
// Check struct size
struct LikeVisibleStruct {
int field;
-// RUN: %clang_cc1 -verify -std=c++11 %s
+// RUN: %clang_cc1 -verify -std=c++14 %s
int foo() {
int x[2]; // expected-note 4 {{array 'x' declared here}}
foo<int>(); // expected-note 1{{in instantiation of function template specialization}}
};
}
+
+namespace var_template_array {
+template <typename T> int arr[2]; // expected-note {{array 'arr<int>' declared here}}
+template <> int arr<float>[1]; // expected-note {{array 'arr<float>' declared here}}
+
+void test() {
+ arr<int>[1] = 0; // ok
+ arr<int>[2] = 0; // expected-warning {{array index 2 is past the end of the array (which contains 2 elements)}}
+ arr<float>[1] = 0; // expected-warning {{array index 1 is past the end of the array (which contains 1 element)}}
+}
+} // namespace var_template_array
};
(void) i;
- C<int>(); // expected-warning {{'C' was marked unused but was used}}
+ C<int>(); // expected-warning {{'C<int>' was marked unused but was used}}
}
// expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}}
template<typename T> constexpr float right<float,T> = 5; // expected-error {{non-static data member cannot be constexpr; did you intend to make it static?}}
template<> static constexpr int right<int,int> = 7;
- template<> static constexpr float right<float,int>; // expected-error {{requires an initializer}}
+ template <> static constexpr float right<float, int>; // expected-error {{declaration of constexpr static data member 'right<float, int>' requires an initializer}}
template static constexpr int right<int,int>; // expected-error {{expected '<' after 'template'}}
};
}
template <typename T> class C3;
template <> class C3<int> {
- static void g(int = f()); // expected-error {{use of default argument to function 'f' that is declared later in class 'C3'}}
+ static void g(int = f()); // expected-error {{use of default argument to function 'f' that is declared later in class 'C3<int>'}}
static int f(int = 10); // expected-note {{default argument declared here}}
};
A (B::*mfp)() = 0;
(b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
- ft(42); // expected-error {{calling 'ft' with incomplete return type 'A'}}
+ ft(42); // expected-error {{calling 'ft<int>' with incomplete return type 'A'}}
}
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s
int g(int);
void f() {
void restrict_ref(int &__restrict); // ok
}
+namespace var_template {
+#if __cplusplus >= 201402L
+int i;
+template <typename> int &ref = i; // ok
+template <> int &ref<float>; // expected-error {{declaration of reference variable 'ref<float>' requires an initializer}}
+#endif
+} // namespace var_template
+
template<typename T> int const_param(const T) {}
int const_ref_param = const_param<int&>(const_ref_param); // no-warning
template <typename T> void f2() { return {1,2}; } // expected-error {{void function 'f2' must not return a value}}
-template <> void f2<float>() { return {1,2}; } // expected-error {{void function 'f2' must not return a value}}
+template <> void f2<float>() { return {1, 2}; } // expected-error {{void function 'f2<float>' must not return a value}}
void test_f2() {
f2<int>();
namespace test1_template {
template <typename T> static void f() {}
-template <> void f<int>() {} // expected-warning {{function 'f' is not needed and will not be emitted}}
+template <> void f<int>() {} // expected-warning {{function 'f<int>' is not needed and will not be emitted}}
template <typename T>
void foo() {
f<int>();
S101 f101(S101 s) { return s; } // expected-warning {{return value of 'f101' is a large (101 bytes) pass-by-value object}} \
// expected-warning {{'s' is a large (101 bytes) pass-by-value argument}}
+void f101_no_param_name(S101) {} // expected-warning {{'' is a large (101 bytes) pass-by-value argument}}
+
+// FIXME: Don't warn when when the return value is subject to (N)RVO.
+
+template <typename T> T foo_template(T);
+template <> S101 foo_template(S101) { return S101(); } // expected-warning {{return value of 'foo_template<rdar8548050::S101>' is a large}}
+ // expected-warning@-1 {{'' is a large (101 bytes) pass-by-value argument}}
+
typedef int Arr[200];
void farr(Arr a) { }
class A {
void g() {} // expected-warning {{member function 'g' is not needed and will not be emitted}}
template <typename T> void gt(T) {}
- template <> void gt<int>(int) {} // expected-warning {{member function 'gt' is not needed and will not be emitted}}
- template <> void gt(float) {} // expected-warning {{member function 'gt' is not needed and will not be emitted}}
+ template <> void gt<int>(int) {} // expected-warning {{member function 'gt<int>' is not needed and will not be emitted}}
+ template <> void gt(float) {} // expected-warning {{member function 'gt<float>' is not needed and will not be emitted}}
template <typename T>
void foo() {
};
template <typename T> struct TA {
- TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA'}}
- ~TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the destructor of 'TA'}}
+ TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA<float>'}}
+ ~TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the destructor of 'TA<float>'}}
virtual void f() = 0; // expected-note 2{{'f' declared here}}
};
};
template <> struct TA<long> {
- TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA'}}
- ~TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the destructor of 'TA'}}
+ TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA<long>'}}
+ ~TA() { f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the destructor of 'TA<long>'}}
virtual void f() = 0; // expected-note 2{{'f' declared here}}
};
template <typename T> struct TA {
virtual void f() = 0; // expected-note {{'f' declared here}}
- TA() { TA::f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA'}} // expected-note {{qualified call to 'TA'::'f' is treated as a virtual call to 'f' due to -fapple-kext}}
+ TA() { TA::f(); } // expected-warning {{call to pure virtual member function 'f' has undefined behavior; overrides of 'f' in subclasses are not available in the constructor of 'TA<int>'}} // expected-note {{qualified call to 'TA<int>'::'f' is treated as a virtual call to 'f' due to -fapple-kext}}
};
struct B : TA<int> { // expected-note {{in instantiation of member function 'TA<int>::TA' requested here}}
template <typename T>
void tf() {} // expected-warning{{unused function template 'tf'}}
- template <> void tf<int>() {} // expected-warning{{unused function 'tf'}}
+ template <> void tf<int>() {} // expected-warning{{unused function 'tf<int>'}}
struct VS {
virtual void vm() { }
template <typename T, typename U> int vt = 0; // expected-warning {{unused variable template 'vt'}}
template <typename T> int vt<T, void> = 0;
- template <> int vt<void, void> = 0; // expected-warning {{unused variable 'vt'}}
+ template <> int vt<void, void> = 0; // expected-warning {{unused variable 'vt<void, void>'}}
}
namespace PR8841 {
namespace rdar8733476 {
static void foo() {} // expected-warning {{function 'foo' is not needed and will not be emitted}}
template <typename T> static void foo_t() {} // expected-warning {{unused function template 'foo_t'}}
-template <> void foo_t<int>() {} // expected-warning {{function 'foo_t' is not needed and will not be emitted}}
+template <> void foo_t<int>() {} // expected-warning {{function 'foo_t<int>' is not needed and will not be emitted}}
template <int>
void bar() {
namespace {
// FIXME: Should be "unused variable template 'var_t'" instead.
template <typename T> const double var_t = 0; // expected-warning {{unused variable 'var_t'}}
- template <> const double var_t<int> = 0; // expected-warning {{variable 'var_t' is not needed and will not be emitted}}
+ template <> const double var_t<int> = 0; // expected-warning {{variable 'var_t<int>' is not needed and will not be emitted}}
int z = sizeof(var_t<int>); // expected-warning {{unused variable 'z'}}
} // namespace
}
namespace {
template <typename T> int abc_template = 0;
- template <> int abc_template<int> = 0; // expected-warning {{variable 'abc_template' is not needed and will not be emitted}}
+ template <> int abc_template<int> = 0; // expected-warning {{variable 'abc_template<int>' is not needed and will not be emitted}}
} // namespace
template <typename T>
int foo(void) {