aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-05-20 16:39:59 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-05-20 16:39:59 -0400
commit5e3f417f3efce4a89d7330eed7f4dba99bcbe3bc (patch)
tree35f1b483465719251a4a4da129ee8d9540173c09 /gcc/cp/typeck2.c
parentbce33ab2b4277852496aaebc9bbdbc223ee25164 (diff)
downloadgcc-5e3f417f3efce4a89d7330eed7f4dba99bcbe3bc.zip
gcc-5e3f417f3efce4a89d7330eed7f4dba99bcbe3bc.tar.gz
gcc-5e3f417f3efce4a89d7330eed7f4dba99bcbe3bc.tar.bz2
DR 1073 PR c++/49082
DR 1073 PR c++/49082 * typeck.c (comp_except_specs): noexcept(false) is not compatible with throw(type-list). * typeck2.c (merge_exception_specifiers): noexcept(false) beats any more limited specification. From-SVN: r173981
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r--gcc/cp/typeck2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 26b9816..c2eff9e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1756,10 +1756,13 @@ add_exception_specifier (tree list, tree spec, int complain)
tree
merge_exception_specifiers (tree list, tree add)
{
- if (!list || !add)
- return NULL_TREE;
+ /* No exception-specifier or noexcept(false) are less strict than
+ anything else. Prefer the newer variant (LIST). */
+ if (!list || list == noexcept_false_spec)
+ return list;
+ else if (!add || add == noexcept_false_spec)
+ return add;
/* For merging noexcept(true) and throw(), take the more recent one (LIST).
- A throw(type-list) spec takes precedence over a noexcept(false) spec.
Any other noexcept-spec should only be merged with an equivalent one.
So the !TREE_VALUE code below is correct for all cases. */
else if (!TREE_VALUE (add))