https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67650

--- Comment #30 from Vincent <vincent.lextrait at gmail dot com> ---
Am using OSX, but I do not believe it makes a big difference. Thanks, Jonathan,
let me know if I can help in any way.

(In reply to Jonathan Wakely from comment #29)
> (In reply to Vincent from comment #27)
> > Sorry for the silly check, are you sure you are trying with -O3 or
> > -fdevirtualize -O2? 
> 
> I've tried both. I'm using x86_64-pc-linux-gnu though.
> 
> 
> > You can try this with 8.1:
> > 
> > void *v;
> > 
> > template <typename T>
> > struct LK: public BLKC
> > {
> >   void rb(){((T*)v)->ax();}
> >   static T* st;
> > };
> > 
> > As a replacement to the call to null, and the missing definition problem is
> > reported.
> 
> OK now I can reproduce it with trunk.
> 
> (In reply to Vincent from comment #28)
> > Other silly check, did you try with my code or your reduced code ?
> 
> Yours.
> 
> Here's the reduced form that gives a link-error with trunk:
> 
> #include <string>
> 
> template <typename T>
> struct RE
> {
>   virtual void rp()=0;
>   void ax(){rp();}
> };
> 
> struct EN : RE<int>
> {
>   EN(::std::string = ""){}
>   void rp(){}
> };
> 
> template <typename OC>
> struct AN : RE<OC>
> {
>   void rp(){}
> };
> 
> template <typename T>
> struct LK
> {
>   T* p = nullptr;
>   virtual void rb(){p->ax();}
> };
> 
> template <const char* K>
> struct LR
> {
>   virtual ~LR(){}
>   struct LLC { virtual ~LLC(){} };
>   LK<AN<LLC>> l;
> };
> 
> constexpr char ET[]="";
> struct I : EN
> {
>   LR<ET> _e;
> };
> 
> int main(){new I();}
> 
> 
> $ ~/gcc/8.1.0/bin/g++ -Wall -O1 -fdevirtualize main.cc 
> main.cc:19:8: warning: ‘void AN<OC>::rp() [with OC = LR<(& ET)>::LLC]’ used
> but never defined
>    void rp(){}
>         ^~
> /tmp/cc4IHAPf.o: In function `LK<AN<LR<&ET>::LLC> >::rb()':
> main.cc:(.text+0x37): undefined reference to `AN<LR<&ET>::LLC>::rp()'
> collect2: error: ld returned 1 exit status

Reply via email to