Hi! For internal functions, we use the whole u.bits of the CALL_EXPR for the internal function number (in this case IFN_LAUNDER), so using the lang flags on it doesn't work. In a couple of other places I've checked that test or set lang flags on CALL_EXPR I saw internal fns special cased early, but admittedly haven't checked everything.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2018-02-19 Jakub Jelinek <ja...@redhat.com> PR c++/84445 * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test TREE_HAS_CONSTRUCTOR if instance is not an internal function call. * g++.dg/cpp1z/launder7.C: New test. --- gcc/cp/class.c.jj 2018-02-16 19:39:08.184061984 +0100 +++ gcc/cp/class.c 2018-02-19 13:34:33.726813207 +0100 @@ -7128,7 +7128,8 @@ fixed_type_or_null (tree instance, int * case CALL_EXPR: /* This is a call to a constructor, hence it's never zero. */ - if (TREE_HAS_CONSTRUCTOR (instance)) + if (CALL_EXPR_FN (instance) + && TREE_HAS_CONSTRUCTOR (instance)) { if (nonnull) *nonnull = 1; --- gcc/testsuite/g++.dg/cpp1z/launder7.C.jj 2018-02-19 13:50:05.954797679 +0100 +++ gcc/testsuite/g++.dg/cpp1z/launder7.C 2018-02-19 13:47:26.603792932 +0100 @@ -0,0 +1,10 @@ +// PR c++/84445 +// { dg-do compile } + +struct A { virtual void foo (); }; + +void +bar (A *p) +{ + __builtin_launder (p)->foo (); +} Jakub