mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-01 22:06:04 +00:00
Bug fix: note diagnosis on expression narrowing should say "variable template" instead of "static data member" when appropriate
llvm-svn: 188409
This commit is contained in:
parent
9b49f22500
commit
dbd6577964
@ -3173,6 +3173,8 @@ def note_function_template_spec_here : Note<
|
|||||||
"in instantiation of function template specialization %q0 requested here">;
|
"in instantiation of function template specialization %q0 requested here">;
|
||||||
def note_template_static_data_member_def_here : Note<
|
def note_template_static_data_member_def_here : Note<
|
||||||
"in instantiation of static data member %q0 requested here">;
|
"in instantiation of static data member %q0 requested here">;
|
||||||
|
def note_template_variable_def_here : Note<
|
||||||
|
"in instantiation of variable template specialization %q0 requested here">;
|
||||||
def note_template_enum_def_here : Note<
|
def note_template_enum_def_here : Note<
|
||||||
"in instantiation of enumeration %q0 requested here">;
|
"in instantiation of enumeration %q0 requested here">;
|
||||||
def note_template_type_alias_instantiation_here : Note<
|
def note_template_type_alias_instantiation_here : Note<
|
||||||
|
@ -524,7 +524,9 @@ void Sema::PrintInstantiationStack() {
|
|||||||
<< Active->InstantiationRange;
|
<< Active->InstantiationRange;
|
||||||
} else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
} else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
||||||
Diags.Report(Active->PointOfInstantiation,
|
Diags.Report(Active->PointOfInstantiation,
|
||||||
diag::note_template_static_data_member_def_here)
|
VD->isStaticDataMember()?
|
||||||
|
diag::note_template_static_data_member_def_here
|
||||||
|
: diag::note_template_variable_def_here)
|
||||||
<< VD
|
<< VD
|
||||||
<< Active->InstantiationRange;
|
<< Active->InstantiationRange;
|
||||||
} else if (EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
|
} else if (EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
|
||||||
|
@ -321,6 +321,15 @@ namespace explicit_specialization {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace narrowing {
|
||||||
|
template<typename T> T v = {1234}; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 1234 to}}
|
||||||
|
#ifdef CXX11
|
||||||
|
// expected-error@-2 {{constant expression evaluates to 1234 which cannot be narrowed to type 'char'}}\
|
||||||
|
// expected-note@-2 {{override this message by inserting an explicit cast}}
|
||||||
|
#endif
|
||||||
|
int k = v<char>; // expected-note {{in instantiation of variable template specialization 'narrowing::v<char>' requested here}}
|
||||||
|
}
|
||||||
|
|
||||||
namespace use_in_structs {
|
namespace use_in_structs {
|
||||||
// TODO:
|
// TODO:
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user