llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

-fno-delayed-template-parsing accepting illegal code.

Open goussepi opened this issue 10 years ago • 1 comments

Bugzilla Link 28290
Version trunk
OS Windows NT
CC @compnerd,@pogo59

Extended Description

clang version 3.9.0 (SVN r273566) (23 June 2016) Target: x86_64-unknown-linux-gnu

It seems the following test case should fail to compile when disabling delayed template parsing. No warnings or error is observed using "-fno-template-parsing-delayed". gcc and icc both emit an error.

  class UBS;
  template <bool bCS> struct FIBH 
  {
   FIBH() { GDN(BS); }
   class UBS* BS;
  };

  extern void foo();

  void foo()
  {
   FIBH<false> IBH;
  }
  void GDN(UBS* BS);

goussepi avatar Jun 24 '16 12:06 goussepi

Bisected: the reported behavior no longer reproduces starting with https://github.com/llvm/llvm-project/commit/878a24ee244a24c39d1c57e9af2e88c621f7cce9.

Godbolt: https://godbolt.org/z/eMe4E9766

  • Clang 9.0.1: Accepts GDN(BS) without a diagnostic
  • Clang 10.0.0: Reports use of undeclared identifier 'GDN' at line 4
  • Clang (trunk): Reports use of undeclared identifier 'GDN' at line 4

This is only an observed change in behavior. I have not checked whether this commit addresses the cause of this report or only stops it from reproducing; whether that resolves the issue is up to the maintainers.

Prepared with assistance from Codex.

hongtaihu avatar Nov 08 '26 13:11 hongtaihu