This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/62063] g++ disregards template specialization and skips try/catch blocks
- From: "ferenc.geczi at ericsson dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 08 Aug 2014 15:18:50 +0000
- Subject: [Bug c++/62063] g++ disregards template specialization and skips try/catch blocks
- Auto-submitted: auto-generated
- References: <bug-62063-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62063
--- Comment #2 from Ferenc GÃczi <ferenc.geczi at ericsson dot com> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Ferenc GÃczi from comment #0)
> > Created attachment 33276 [details]
> > Source code for reproducing the reported issue
> >
> > g++ disregards that template specialization might happen in a different
> > compilation unit.
>
> How is the compiler supposed to know that?
>
> If you don't declare a specialization before it would be needed the compiler
> will not use it, and the program has undefined behaviour.
>
> > For comparison, clang++ works as expected with -O0, without the
> > -fnon-callexceptions.
> > Although it has the same the behavior with higher optimization levels.
>
> That should tell you your expectation is wrong.
Indeed. (In reply to Jonathan Wakely from comment #1)
> (In reply to Ferenc GÃczi from comment #0)
> > Created attachment 33276 [details]
> > Source code for reproducing the reported issue
> >
> > g++ disregards that template specialization might happen in a different
> > compilation unit.
>
> How is the compiler supposed to know that?
>
> If you don't declare a specialization before it would be needed the compiler
> will not use it, and the program has undefined behaviour.
>
> > For comparison, clang++ works as expected with -O0, without the
> > -fnon-callexceptions.
> > Although it has the same the behavior with higher optimization levels.
>
> That should tell you your expectation is wrong.
Thank you for the quick reply, and I apologize for the false alarm.
Now I found it in the standard. You are absolutely right.