Bug 96957 (cwg1390) - [11/12/13/14 Regression] GCC thinks a non-dependent base is dependent because of template alias
Summary: [11/12/13/14 Regression] GCC thinks a non-dependent base is dependent because...
Status: SUSPENDED
Alias: cwg1390
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 10.2.1
: P2 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks: c++-core-issues
  Show dependency treegraph
 
Reported: 2020-09-07 15:32 UTC by Anders Granlund
Modified: 2023-07-07 10:38 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 5.1.0
Known to fail: 6.1.0
Last reconfirmed: 2023-07-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Granlund 2020-09-07 15:32:41 UTC
Consider the following c++ program:

  class A
  {
      protected:
          int x;
  };

  template<typename X>
  using B = A;

  template<typename T>
  class C : public B<T>
  {
      public:
          void f()
          {
              x = 0;
          }
  };

  int main()
  {
  }

Compile it with "-std=c++17 -pedantic-errors".

Expected behaviour:
  
  Since the base class is not dependent (see http://wg21.link/cwg1390 ) the
  name lookup of x should succeed and no error message should be outputed
  during the compilation.

Observed behaviour:
  
  An compilation error about failing the name lookup of x was outputed during
  the compilation.

GCC is correctly compiling the program with no error messages outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435
Comment 2 Anders Granlund 2020-09-08 06:53:09 UTC
Correction to my first comment:

"GCC is correctly compiling the program with no error messages outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435"

should be:

"Clang is correctly rejecting the program with a error message outputed. See the discussion in: https://bugs.llvm.org/show_bug.cgi?id=47435"
Comment 3 Andrew Pinski 2021-08-03 05:44:34 UTC
Confirmed.  Note I suspect the reason why it worked in GCC 5 was because there was some rewrite in GCC 6 to correct aliases.
Comment 4 Marek Polacek 2022-04-21 22:11:40 UTC
DR1390 is still not resolved.
Comment 5 Richard Biener 2022-05-27 09:43:25 UTC
GCC 9 branch is being closed
Comment 6 Jakub Jelinek 2022-06-28 10:41:49 UTC
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Comment 7 Richard Biener 2023-07-07 10:38:03 UTC
GCC 10 branch is being closed.