diff options
author | Jason Merrill <jason@redhat.com> | 2019-11-05 18:50:08 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2019-11-05 18:50:08 -0500 |
commit | f22f817cbdffe5b4e7d0ba7ab0eeb56ee61b3b72 (patch) | |
tree | 297e198f67433c4deed3dde93c59355d41a91c01 /gcc/cp/constexpr.c | |
parent | a81ffd93b83c4be250514ff385b5b88fa5c3835b (diff) | |
download | gcc-f22f817cbdffe5b4e7d0ba7ab0eeb56ee61b3b72.zip gcc-f22f817cbdffe5b4e7d0ba7ab0eeb56ee61b3b72.tar.gz gcc-f22f817cbdffe5b4e7d0ba7ab0eeb56ee61b3b72.tar.bz2 |
Various small C++ changes.
Wrappers for lookup_qualified_name and build_x_binary_op to make calling
them more convenient in places, and a function named contextual_conv_bool
for places that want contextual conversion to bool.
I noticed that we weren't showing the declaration location when we complain
about a call to a non-constexpr function where a constant expression is
required.
If maybe_instantiate_noexcept doesn't actually instantiate, there's no
reason for it to mess with clones.
* constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
* pt.c (maybe_instantiate_noexcept): Only update clones if we
instantiated.
* typeck.c (contextual_conv_bool): New.
* name-lookup.c (lookup_qualified_name): Add wrapper overload taking
C string rather than identifier.
* parser.c (cp_parser_userdef_numeric_literal): Use it.
* rtti.c (emit_support_tinfos): Use it.
* cp-tree.h (ovl_op_identifier): Change to inline functions.
(build_x_binary_op): Add wrapper with fewer parms.
From-SVN: r277862
Diffstat (limited to 'gcc/cp/constexpr.c')
-rw-r--r-- | gcc/cp/constexpr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 72de2ef..ce910cd 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -934,7 +934,10 @@ explain_invalid_constexpr_fn (tree fun) if (!DECL_DEFAULTED_FN (fun) && !LAMBDA_TYPE_P (CP_DECL_CONTEXT (fun)) && !is_instantiation_of_constexpr (fun)) - return; + { + inform (DECL_SOURCE_LOCATION (fun), "%qD declared here", fun); + return; + } if (diagnosed == NULL) diagnosed = new hash_set<tree>; if (diagnosed->add (fun)) |