[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-03-18 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:af8656be8df68ac26840f7844430fd595255ebd2

commit r10-7236-gaf8656be8df68ac26840f7844430fd595255ebd2
Author: Jakub Jelinek 
Date:   Wed Mar 18 08:53:23 2020 +0100

c++: Diagnose a deduction guide in a wrong scope [PR91759]

The following testcase is accepts-invalid since r7-6608-ga56c0ac08242269b.
Before that change we had this
"deduction guide %qD must be declared in the same scope as %qT"
diagnostics for it, after the change it is expected to be diagnosed
in set_decl_namespace at the not_found: label in there.  On this testcase
nothing is diagnosed though, because set_decl_namespace isn't called at
all,
as in_namespace is NULL.

The following patch restores the old warning but does it only in case we
don't call set_decl_namespace.

2020-03-18  Jakub Jelinek  

PR c++/91759
* decl.c (grokfndecl): Restore old diagnostics about deduction
guide declared in different scope if in_namespace is NULL_TREE.

* g++.dg/cpp1z/class-deduction72.C: New test.

[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-03-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

--- Comment #4 from Jakub Jelinek  ---
Created attachment 48045
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48045=edit
gcc10-pr91759.patch

So, shall we restore the old diagnostics for the case where set_decl_namespace
isn't called like this?  Seems to work on check-c++-all
RUNTESTFLAGS=dg.exp=*deduct* so far.

[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-03-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
The commit removed the "must be declared in the same scope as" diagnostics
altogether and expects set_decl_namespace not_found: to diagnose it instead.
But on this testcase, in_namespace is false in the caller and so
set_decl_namespace is never called from grokfndecl.

[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-03-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|8.4 |8.5

--- Comment #2 from Jakub Jelinek  ---
GCC 8.4.0 has been released, adjusting target milestone.

[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-02-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |8.4

[Bug c++/91759] [8/9/10 Regression] g++ accepts ill-formed deduction guides in wrong scope since r7-6608-ga56c0ac08242269b

2020-01-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91759

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-01-29
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
  Known to work||6.4.0
Summary|g++ accepts ill-formed  |[8/9/10 Regression] g++
   |deduction guides in wrong   |accepts ill-formed
   |scope   |deduction guides in wrong
   ||scope since
   ||r7-6608-ga56c0ac08242269b
 Ever confirmed|0   |1
  Known to fail||10.0, 7.4.0, 8.3.0, 9.2.0

--- Comment #1 from Martin Liška  ---
Confirmed, started with r7-6608-ga56c0ac08242269b. We rejected the code before
the revision:

pr91759.cc:8:1: error: deduction guide ‘N::X(int)-> N::X’ must be declared
in the same scope as ‘N::X’
 X(int) -> X;
 ^
pr91759.cc:3:12: note:   declared here
 struct X{ X(int); };
^