aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 40c2120..057c1fb 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7722,12 +7722,19 @@ grokdeclarator (const cp_declarator *declarator,
else if (/* If the qualifying type is already complete, then we
can skip the following checks. */
!COMPLETE_TYPE_P (ctype)
- /* If a function is being defined, then the qualifying
- type must be complete. The qualifying type may be
- incomplete for a declaration only if the qualifying
- type is one of the classes presently being defined,
- or if it is a dependent type. */
- && (funcdef_flag
+ && (/* If the function is being defined, then
+ qualifying type must certainly be complete. */
+ funcdef_flag
+ /* A friend declaration of "T::f" is OK, even if
+ "T" is a template parameter. But, if this
+ function is not a friend, the qualifying type
+ must be a class. */
+ || (!friendp && !CLASS_TYPE_P (ctype))
+ /* For a declaration, the type need not be
+ complete, if either it is dependent (since there
+ is no meaningful definition of complete in that
+ case) or the qualifying class is currently being
+ defined. */
|| !(dependent_type_p (ctype)
|| currently_open_class (ctype)))
/* Check that the qualifying type is complete. */