Commit 7731b8e6 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/92965 ("note: 'x' is not public" emitted even when no error is emitted)

	PR c++/92965
	* pt.c (invalid_nontype_parm_type_p): Call structural_type_p with
	explain=true only if emitting error.

	* g++.dg/cpp2a/nontype-class27.C: New test.

From-SVN: r279684
parent b804bd89
2019-12-20 Jakub Jelinek <jakub@redhat.com>
PR c++/92965
* pt.c (invalid_nontype_parm_type_p): Call structural_type_p with
explain=true only if emitting error.
PR c++/92966
* method.c (early_check_defaulted_comparison): Don't set
DECL_MAYBE_DELETED when returning false.
......
......@@ -25838,11 +25838,13 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
return true;
if (!structural_type_p (type))
{
auto_diagnostic_group d;
if (complain & tf_error)
error ("%qT is not a valid type for a template non-type parameter "
"because it is not structural", type);
{
auto_diagnostic_group d;
error ("%qT is not a valid type for a template non-type "
"parameter because it is not structural", type);
structural_type_p (type, true);
}
return true;
}
return false;
......
2019-12-20 Jakub Jelinek <jakub@redhat.com>
PR c++/92965
* g++.dg/cpp2a/nontype-class27.C: New test.
PR c++/92966
* g++.dg/cpp2a/spaceship-eq8.C: New test.
......
// PR c++/92965
// { dg-do compile { target c++2a } }
template<int>
class TS {
int x; // { dg-bogus "is not public" }
public:
constexpr TS(int) {}
};
TS(int) -> TS<1>;
template<TS> void foo() {}
template<int> void foo() {}
void test() { foo<2>(); }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment