re PR c++/13981 (Give message about incomplete class that might be implicitly upcasted.)
/cp 2014-05-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/13981 * typeck.c (convert_for_assignment): Provide an inform for pointers to incomplete class types. /testsuite 2014-05-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/13981 * g++.dg/diagnostic/pr13981.C: New. From-SVN: r210217
This commit is contained in:
parent
add0c11114
commit
7e422c4f04
@ -1,3 +1,9 @@
|
||||
2014-05-08 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/13981
|
||||
* typeck.c (convert_for_assignment): Provide an inform for pointers
|
||||
to incomplete class types.
|
||||
|
||||
2014-05-07 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/61083
|
||||
|
@ -8094,6 +8094,14 @@ convert_for_assignment (tree type, tree rhs,
|
||||
default:
|
||||
gcc_unreachable();
|
||||
}
|
||||
if (TYPE_PTR_P (rhstype)
|
||||
&& TYPE_PTR_P (type)
|
||||
&& CLASS_TYPE_P (TREE_TYPE (rhstype))
|
||||
&& CLASS_TYPE_P (TREE_TYPE (type))
|
||||
&& !COMPLETE_TYPE_P (TREE_TYPE (rhstype)))
|
||||
inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL
|
||||
(TREE_TYPE (rhstype))),
|
||||
"class type %qT is incomplete", TREE_TYPE (rhstype));
|
||||
}
|
||||
return error_mark_node;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-05-08 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/13981
|
||||
* g++.dg/diagnostic/pr13981.C: New.
|
||||
|
||||
2014-05-08 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR tree-optimization/59100
|
||||
|
12
gcc/testsuite/g++.dg/diagnostic/pr13981.C
Normal file
12
gcc/testsuite/g++.dg/diagnostic/pr13981.C
Normal file
@ -0,0 +1,12 @@
|
||||
// PR c++/13981
|
||||
|
||||
struct A {};
|
||||
struct B; // { dg-message "is incomplete" }
|
||||
|
||||
void func( A *a );
|
||||
|
||||
int main()
|
||||
{
|
||||
B *b = 0;
|
||||
func(b); // { dg-error "cannot convert" }
|
||||
}
|
Loading…
Reference in New Issue
Block a user