diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/parser.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wmismatched-tags-10.C | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 4b98595..9a9f859 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -33666,7 +33666,8 @@ class_decl_loc_t::add (cp_parser *parser, location_t key_loc, bool key_redundant = (!def_p && !decl_p && (decl == type_decl || TREE_CODE (decl) == TEMPLATE_DECL - || TYPE_BEING_DEFINED (type))); + || (CLASS_TYPE_P (type) + && TYPE_BEING_DEFINED (type)))); if (key_redundant && class_key != class_type @@ -33704,7 +33705,7 @@ class_decl_loc_t::add (cp_parser *parser, location_t key_loc, } else { - /* TYPE was previously defined in some unknown precompiled hdeader. + /* TYPE was previously defined in some unknown precompiled header. Simply add a record of its definition at an unknown location and proceed below to add a reference to it at the current location. (Declarations in precompiled headers that are not definitions diff --git a/gcc/testsuite/g++.dg/warn/Wmismatched-tags-10.C b/gcc/testsuite/g++.dg/warn/Wmismatched-tags-10.C new file mode 100644 index 0000000..d7e1074 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wmismatched-tags-10.C @@ -0,0 +1,10 @@ +// PR c++/105725 +// { dg-do compile { target c++14 } } +// { dg-options "-Wall -Wmismatched-tags" } + +template <bool> struct enable_if; +template <bool Cond> using enable_if_t = typename enable_if<Cond>::type; +template <typename> bool is_class_v; +template <class, class> bool B; +template <class T> +bool B<T, enable_if_t<is_class_v<class T::foo>>>; |