[Bug c++/90623] compilation error with fold expression and parameter pack

2019-05-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90623

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-25
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Ouch, it actually ICEs:

$ xg++ -c 90623.C -std=c++17
90623.C: In instantiation of ‘main():: [with auto:4 = {int,
int, int}]’:
90623.C:15:46:   required from here
90623.C:9:21: error: redeclaration of ‘const int xs#1’
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: note: ‘const int xs#1’ previously declared here
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: error: redeclaration of ‘const int xs#0’
90623.C:9:21: note: ‘const int xs#0’ previously declared here
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: error: redeclaration of ‘const int xs#2’
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: note: ‘const int xs#2’ previously declared here
90623.C:9:21: error: redeclaration of ‘const int xs#2’
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: note: ‘const int xs#2’ previously declared here
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: error: redeclaration of ‘const int xs#0’
90623.C:9:21: note: ‘const int xs#0’ previously declared here
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: error: redeclaration of ‘const int xs#1’
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
90623.C:9:25: note: ‘const int xs#1’ previously declared here
90623.C:8:12: error: designator order for field ‘main()::
[with auto:4 = {int, int, int}]’ does not
match declaration order in ‘main():: [with auto:4 = {int,
int, int}]::’
8 | return [=](auto f) {
  |^
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  |  
~~~
   10 |   // other version  without fold expression // same problem
  |   ~
   11 |   //
(void)std::initializer_list{((void)call_cart(f,xs,xs...),0)...};
  |  

   12 | };
  | ~   
90623.C: In instantiation of ‘main():: [with auto:4 = {int,
int, int}]:: [with auto:5 = main()::]’:
90623.C:17:56:   required from here
90623.C:9:21: internal compiler error: in insert_capture_proxy, at
cp/lambda.c:311
9 |   (call_cart(f, xs, xs... ), ...); // ok with gcc8 // error with
gcc9
  | ^~
0x99e0a1 insert_capture_proxy(tree_node*)
/home/mpolacek/src/gcc/gcc/cp/lambda.c:311
0xab3331 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/mpolacek/src/gcc/gcc/cp/pt.c:17137
0xab271c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/mpolacek/src/gcc/gcc/cp/pt.c:17036
0xab4d00 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/mpolacek/src/gcc/gcc/cp/pt.c:17330
0xad7289 instantiate_decl(tree_node*, bool, bool)
/home/mpolacek/src/gcc/gcc/cp/pt.c:24760
0x95f8d2 maybe_instantiate_decl
/home/mpolacek/src/gcc/gcc/cp/decl2.c:5303
0x9605b6 mark_used(tree_node*, int)
/home/mpolacek/src/gcc/gcc/cp/decl2.c:5459
0x86267d build_over_call
/home/mpolacek/src/gcc/gcc/cp/call.c:8646
0x852ef0 build_op_call_1
/home/mpolacek/src/gcc/gcc/cp/call.c:4768
0x8530b2 build_op_call(tree_node*, vec**, int)
/home/mpolacek/src/gcc/gcc/cp/call.c:4797
0xb0f66a finish_call_expr(tree_node*, vec**, bool,
bool, int)
/home/mpolacek/src/gcc/gcc/cp/semantics.c:2601
0xa0cde9 cp_parser_postfix_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:7375
0xa0f681 cp_parser_unary_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:8461
0xa10adb cp_parser_cast_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:9346
0xa10bc8 cp_parser_binary_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:9449
0xa11986 cp_parser_assignment_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:9747
0xa11d11 cp_parser_expression
/home

[Bug c++/87699] Implement CWG 1512

2019-05-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
The warning is in place and triggers with -Wextra:

warning (OPT_Wextra,
 "ordered comparison of pointer with integer zero");

I guess we should make it a permerror.

[Bug c++/90572] [9/10 Regression] Wrong disambiguation in friend declaration as implicit typename context

2019-05-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Marek Polacek  ---
Should be fixed.

[Bug c++/90572] [9/10 Regression] Wrong disambiguation in friend declaration as implicit typename context

2019-05-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

--- Comment #4 from Marek Polacek  ---
Author: mpolacek
Date: Sat May 25 14:46:15 2019
New Revision: 271620

URL: https://gcc.gnu.org/viewcvs?rev=271620=gcc=rev
Log:
PR c++/90572 - wrong disambiguation in friend declaration.
* parser.c (cp_parser_constructor_declarator_p): Don't allow missing
typename for friend declarations.

* g++.dg/cpp2a/typename16.C: New test.
* g++.dg/parse/friend13.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp2a/typename16.C
branches/gcc-9-branch/gcc/testsuite/g++.dg/parse/friend13.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/parser.c

[Bug c++/90572] [9/10 Regression] Wrong disambiguation in friend declaration as implicit typename context

2019-05-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Sat May 25 14:39:12 2019
New Revision: 271619

URL: https://gcc.gnu.org/viewcvs?rev=271619=gcc=rev
Log:
PR c++/90572 - wrong disambiguation in friend declaration.
* parser.c (cp_parser_constructor_declarator_p): Don't allow missing
typename for friend declarations.

* g++.dg/cpp2a/typename16.C: New test.
* g++.dg/parse/friend13.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp2a/typename16.C
trunk/gcc/testsuite/g++.dg/parse/friend13.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/90572] [9/10 Regression] Wrong disambiguation in friend declaration as implicit typename context

2019-05-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

Marek Polacek  changed:

   What|Removed |Added

   Keywords|wrong-code  |patch

--- Comment #2 from Marek Polacek  ---
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01716.html

[Bug c++/90572] [9/10 Regression] Wrong disambiguation in friend declaration as implicit typename context

2019-05-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |9.2
Summary|Wrong disambiguation in |[9/10 Regression] Wrong
   |friend declaration as   |disambiguation in friend
   |implicit typename context   |declaration as implicit
   ||typename context

[Bug c++/90590] enumeration value not handled in switch warning for std::ios_base::seek_dir

2019-05-23 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90590

--- Comment #6 from Marek Polacek  ---
(In reply to Jonathan Wakely from comment #5)
> (In reply to Marek Polacek from comment #4)
> > Suppressing the warning when the enumerator comes from a system header
> > should be fairly easy using in_system_header_at.
> 
> Yes, I got that working myself already.

Do you want this PR then?

> > But for the "use reserved
> > names" requirement -- should we just check whether the name of an enumerator
> > starts with an '_'?
> 
> No, because "_" and "_foo" are not reserved names.
> 
> I suggest "_[_A-Z]" i.e. underscore followed by either another underscore or
> uppercase letter. In practice, for libstdc++'s purposes, it might be enough
> to check for just "_[_S]" but I'd have to double-check that.

Good point.

[Bug c++/90590] enumeration value not handled in switch warning for std::ios_base::seek_dir

2019-05-23 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90590

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek  ---
Reduced:

$ cat x.h
#pragma GCC system_header
enum E { _A, _B, _C };

$ cat x.C
#include "x.h"

void
g ()
{
  E e = _A;
  switch (e)
{
case _A:
case _B:
  break;
}
}

$ ./cc1plus -quiet x.C -Wswitch
x.C: In function ‘void g()’:
x.C:7:10: warning: enumeration value ‘_C’ not handled in switch [-Wswitch]
7 |   switch (e)
  |  ^

Suppressing the warning when the enumerator comes from a system header should
be fairly easy using in_system_header_at.  But for the "use reserved names"
requirement -- should we just check whether the name of an enumerator starts
with an '_'?

[Bug c++/90583] New: Implement DR 1722, lambda to function pointer conversion should be noexcept

2019-05-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90583

Bug ID: 90583
   Summary: Implement DR 1722, lambda to function pointer
conversion should be noexcept
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Cf. http://wg21.link/cwg1722

void
foo ()
{
  auto l = [](int){ return 42; };
  static_assert(noexcept((int (*)(int))(l)), "");
}

[Bug c++/90572] Wrong disambiguation in friend declaration as implicit typename context

2019-05-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90572

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-05-22
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Thanks for the bug report; mine.

[Bug c++/90309] Spurious warning shift-negative-value

2019-05-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90309

--- Comment #4 from Marek Polacek  ---
(In reply to Marek Polacek from comment #3)
> Seems we need to add a warning sentinel.

...but first it'd be nice to find out *why* we're shifting by -4 and how that
can be.

[Bug c++/90309] Spurious warning shift-negative-value

2019-05-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90309

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
Seems we need to add a warning sentinel.

[Bug c++/90548] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:18877

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90548

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #4 from Marek Polacek  ---
I may have a fix.

[Bug c++/90548] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:18877

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90548

--- Comment #3 from Marek Polacek  ---
We ended up with an empty call_args vec because the pack expanded here:
18842 /* Expand the pack expansion and push each entry onto
18843CALL_ARGS.  */
18844 arg = tsubst_pack_expansion (arg, args, complain,
in_decl);
expanded to an empty vector.  So nothing got pushed onto call_args.

[Bug c++/85679] [DR2094] __is_trivially_copyable returns false with volatile scalar type

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85679

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
Fixed for GCC 10.  Not backporting this.

[Bug c++/85679] [DR2094] __is_trivially_copyable returns false with volatile scalar type

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85679

--- Comment #5 from Marek Polacek  ---
Author: mpolacek
Date: Mon May 20 19:10:57 2019
New Revision: 271435

URL: https://gcc.gnu.org/viewcvs?rev=271435=gcc=rev
Log:
CWG 2094 - volatile scalars are trivially copyable.
PR c++/85679
* tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
scalar types.

* g++.dg/ext/is_trivially_constructible1.C: Change the expected result
for volatile int.
* g++.dg/ext/is_trivially_copyable.C: New test.

* testsuite/20_util/is_trivially_copyable/value.cc: Change the expected
result for volatile int.

Added:
trunk/gcc/testsuite/g++.dg/ext/is_trivially_copyable.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/ext/is_trivially_constructible1.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/testsuite/20_util/is_trivially_copyable/value.cc

[Bug c++/90550] ICE in determine_visibility, at cp/decl2.c:2567

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90550

--- Comment #2 from Marek Polacek  ---
Started with r145440.  Before that:

90550.C: In function ‘void f() [with  = int]’:
90550.C:9:   instantiated from here
90550.C:5: error: ‘b’ has incomplete type

[Bug c++/90550] ICE in determine_visibility, at cp/decl2.c:2567

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90550

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-20
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug c++/90548] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:18877

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90548

--- Comment #2 from Marek Polacek  ---
(gdb) p (*call_args).is_empty()
$5 = true
so
tree arg = (*call_args)[i];
where i == 0 won't work.

[Bug c++/90548] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:18877

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90548

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-20
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |9.2
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
commit 64e3499e2386103c6842ffdf0b8eeae1d3798d29
Author: jason 
Date:   Wed Jan 30 02:43:04 2019 +

PR c++/86943 - wrong code converting lambda to function pointer.

In this PR, instantiating the static thunk returned from the generic lambda
conversion function template was using normal overload resolution, which
meant calling an extra constructor when forwarding its argument.  Fixed by
special-casing thunk calls significantly more.

* lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
call.  Only forward parms for decltype.
* pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle
CALL_FROM_THUNK_P
specially.
* typeck.c (check_return_expr): Don't mess with a thunk call.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268377
138bc75d-0d04-0410-961f-82ee72b054a4

[Bug c++/88335] Implement P1073R3, C++20 immediate functions (consteval).

2019-05-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88335

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-20
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/69316] Implement CWG 393

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69316

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #1 from Marek Polacek  ---
This was fixed in GCC 8 by r250137.  In C++17, the code is accepted without
warnings even with -Wpedantic.

[Bug c++/86476] Members declared later in a class appear to be unavailable

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86476

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Marek Polacek  ---
Patch available: .

[Bug c++/90537] Implement P1286R2, Contra CWG DR1778

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90537

Marek Polacek  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-05-20
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Mine.

[Bug c++/90537] New: Implement P1286R2, Contra CWG DR1778

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90537

Bug ID: 90537
   Summary: Implement P1286R2, Contra CWG DR1778
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

(NB: This assumes that my
<https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00511.html> has gone in.)

Implement <http://wg21.link/p1286r2>.  This should compile now:

struct X { X(); };

struct A {
  struct B {
B() noexcept(A::value) = default;
X x;
  };
  decltype(B()) b;
  static constexpr bool value = true;
};
A::B b;

static_assert(noexcept(A::B()), "");

but we print

p1286.C:11:6: error: use of deleted function ‘A::B::B()’
   11 | A::B b;
  |  ^
p1286.C:5:5: note: ‘A::B::B() noexcept’ is implicitly deleted because its
exception-specification does not match the implicit exception-specification ‘’
5 | B() noexcept(A::value) = default;
  | ^
p1286.C:13:29: error: use of deleted function ‘A::B::B()’
   13 | static_assert(noexcept(A::B()), "");
  | ^

Latest clang/EDG compile it fine.

[Bug c++/85679] [DR2094] __is_trivially_copyable returns false with volatile scalar type

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85679

Marek Polacek  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #4 from Marek Polacek  ---
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg01173.html

[Bug c++/90534] ICE in consteval in GCCs 8.3, 8.2, 8.1, 7.3, 7.2 and 7.1

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90534

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-19
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
This was fixed by r266816 aka c++/85569.

[Bug c++/85679] [DR2094] __is_trivially_copyable returns false with volatile scalar type

2019-05-19 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85679

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #3 from Marek Polacek  ---
trivially_copyable_p needs a small tweak.

[Bug c++/60531] template function not resolved when comparing functions

2019-05-18 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60531

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek  ---
(In reply to Harald van Dijk from comment #3)
> I posted a patch <https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00539.html>
> over a month ago; I am including the link here in case I end up forgetting
> to keep pinging.

Sorry about that and thanks for the patch.  It looked fine to me but I'll try
to take a closer look at it next week (but won't be able to approve it anyway.)

[Bug c++/89576] [8 Regression] constexpr not working if implicitly captured in a lambda in a function template (gcc 8.3+)

2019-05-17 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89576

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
Assuming fixed.

[Bug c++/90505] [9/10 Regression] g++ rejects a valid code

2019-05-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90505

--- Comment #3 from Marek Polacek  ---
Seems to be caused by this change:

@@ -16327,15 +16388,6 @@ cp_parser_template_name (cp_parser* parser,
}
 }

-  /* If DECL is dependent, and refers to a function, then just return
- its name; we will look it up again during template instantiation.  */
-  if (DECL_FUNCTION_TEMPLATE_P (decl) || !DECL_P (decl))
-{
-  tree scope = ovl_scope (decl);
-  if (TYPE_P (scope) && dependent_type_p (scope))
-   return identifier;
-}
-
   return decl;
 }

[Bug c++/90505] [9/10 Regression] g++ rejects a valid code

2019-05-16 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90505

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #2 from Marek Polacek  ---
Mine then.

[Bug c++/90490] [9/10 Regression] ICE on noexcept with decltype expression

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90490

--- Comment #3 from Marek Polacek  ---
And we also started rejecting this:

struct R { constexpr operator bool() { return false;} };

template 
struct S {
  void g() noexcept(decltype(R{ }) { }) {
  }
};

[Bug c++/81159] New warning idea: -Wself-move

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c++/81862] [C++11][constexpr] Constructor Parenthesized Initialization of Member Array Crash

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81862

--- Comment #2 from Marek Polacek  ---
Reduced.  But the PR86917 is much simpler, so I'd start with fixing that one.

template  struct b;
template  struct g;
template  struct g, b> {
  using e = b;
};
template 
struct i : g::e, typename i::e> {};
template <> struct i<1> { typedef b<0> e; };
template  struct j {};
template ::e> struct o;
template  struct o> {
  typedef j e;
};
template  using l = typename o::e;
template  using m = j;
template  using n = l;
struct q {
  constexpr q(int) { }
};
template  struct G { typedef q r[p]; };
template  struct H {
  typename G::r s;
  q operator[](long);
};
template  class I {
public:
  constexpr I(t... v) : I(v..., n<5>{}) {}
  template 
  constexpr I(t... v, m x) : u({y(v..., x)[w]...}) {}
  template  auto y(t..., m) {
H<5> a{w...};
return a;
  }
  q u[5];
};
int main() { I c(2, false); }

[Bug c++/81862] [C++11][constexpr] Constructor Parenthesized Initialization of Member Array Crash

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81862

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org
 Depends on||86917

--- Comment #1 from Marek Polacek  ---
Started with r230365.  Most likely a dup of PR86917.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86917
[Bug 86917] [7/8/9/10 Regression] ICE  in verify_ctor_sanity, at
cp/constexpr.c:2798

[Bug c++/90495] Incorrect parsing of a()->b construction

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90495

Marek Polacek  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-15
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Changed in r236221.  Not a bug: the fix is to use the template disambiguator.  

But the diagnostics is pretty awful so I'll confirm the PR for that part.

[Bug c++/90490] [9/10 Regression] ICE on noexcept with decltype expression

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90490

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Target Milestone|--- |9.2
Summary|ICE on noexcept with|[9/10 Regression] ICE on
   |decltype expression |noexcept with decltype
   ||expression

--- Comment #2 from Marek Polacek  ---
Started with r270319.  Mine.

[Bug c++/90490] ICE on noexcept with decltype expression

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90490

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-15
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

$ ./cc1plus -quiet 90490.C
90490.C:3:41: internal compiler error: in verify_ctor_sanity, at
cp/constexpr.c:2959
3 |   void g() noexcept(decltype(int{ }) { }) {
  | ^
0x8afa98 verify_ctor_sanity
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:2959
0x8afe63 cxx_eval_bare_aggregate
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:3003
0x8b8282 cxx_eval_constant_expression
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:4936
0x8b72ec cxx_eval_constant_expression
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:4611
0x8b9ac9 cxx_eval_outermost_constant_expr
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:5328
0x8ba54d maybe_constant_value(tree_node*, tree_node*, bool)
/home/mpolacek/src/gcc/gcc/cp/constexpr.c:5541
0xb88a45 check_narrowing(tree_node*, tree_node*, int, bool)
/home/mpolacek/src/gcc/gcc/cp/typeck2.c:929
0x85c7bb convert_like_real
/home/mpolacek/src/gcc/gcc/cp/call.c:7457
0x850615 build_converted_constant_expr_internal
/home/mpolacek/src/gcc/gcc/cp/call.c:4283
0x850736 build_converted_constant_bool_expr(tree_node*, int)
/home/mpolacek/src/gcc/gcc/cp/call.c:4327
0x97e624 build_noexcept_spec(tree_node*, int)
/home/mpolacek/src/gcc/gcc/cp/except.c:1288
0xa2f5dd cp_parser_noexcept_specification_opt
/home/mpolacek/src/gcc/gcc/cp/parser.c:25267
0xa2f626 cp_parser_exception_specification_opt
/home/mpolacek/src/gcc/gcc/cp/parser.c:25294
0xa2643d cp_parser_direct_declarator
/home/mpolacek/src/gcc/gcc/cp/parser.c:20824
0xa2613f cp_parser_declarator
/home/mpolacek/src/gcc/gcc/cp/parser.c:20655
0xa2e346 cp_parser_member_declaration
/home/mpolacek/src/gcc/gcc/cp/parser.c:24648
0xa2d834 cp_parser_member_specification_opt
/home/mpolacek/src/gcc/gcc/cp/parser.c:24264
0xa2b85b cp_parser_class_specifier_1
/home/mpolacek/src/gcc/gcc/cp/parser.c:23405
0xa2c639 cp_parser_class_specifier
/home/mpolacek/src/gcc/gcc/cp/parser.c:23667
0xa1fc9a cp_parser_type_specifier
/home/mpolacek/src/gcc/gcc/cp/parser.c:17412
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug tree-optimization/90491] simple operation with unsigned integer and conversion to float/double not vectorized

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90491

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org
  Component|c++ |tree-optimization

--- Comment #1 from Marek Polacek  ---
Not a C++ FE issue.

[Bug c++/90484] [9/10 Regression] ICE in equal_mem_array_ref_p at gcc/tree-ssa-scopedtables.c:550 since r270433 on i586

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90484

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-15
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed with -m32.

[Bug c++/90480] [8/9/10 Regression] ICE when calling operator() inside a lambda defined in a template class method

2019-05-15 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90480

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
Started with r257093.

[Bug c++/90455] braced-init and incomplete type instantiation

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90455

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
Reduced, clang++ compiles it.

struct B;
template  struct b {
  void operator()(a *) { sizeof(a); }
};
struct c {
  struct D {
using d = B *;
  };

  using e = D::d;
  e f();
};
template  class g {
  c h;
  using i = b;
public:
  ~g() {
auto j = h.f();
k()(j);
  }
  i k();
};
struct l {
  g m{};
};

[Bug c++/68918] spurious "invalid use of incomplete type" in trailing return type

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68918

--- Comment #2 from Marek Polacek  ---
Author: mpolacek
Date: Tue May 14 21:19:01 2019
New Revision: 271193

URL: https://gcc.gnu.org/viewcvs?rev=271193=gcc=rev
Log:
PR c++/68918
* g++.dg/cpp0x/decltype71.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/decltype71.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/68918] spurious "invalid use of incomplete type" in trailing return type

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68918

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Marek Polacek  ---
Fixed.

[Bug c++/70156] incorrect "incomplete type" error initializing a static const data member

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70156

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Marek Polacek  ---
Fixed.

[Bug c++/70156] incorrect "incomplete type" error initializing a static const data member

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70156

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Tue May 14 21:10:58 2019
New Revision: 271192

URL: https://gcc.gnu.org/viewcvs?rev=271192=gcc=rev
Log:
PR c++/70156
* g++.dg/init/static5.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/init/static5.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/63296] g++ reports incomplete type for static template member of template class

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63296

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
Re-confirmed with today's trunk:

$ ./cc1plus -quiet 63296.C
63296.C: In instantiation of ‘struct list >’:
63296.C:8:26:   required from ‘struct myclass’
63296.C:11:14:   required from here
63296.C:3:7: error: ‘list::member’ has incomplete type
3 | c member;
  |   ^~
63296.C:7:8: note: declaration of ‘struct myclass’
7 | struct myclass {
  |^~~

[Bug c++/68918] spurious "invalid use of incomplete type" in trailing return type

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68918

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-05-14
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Fixed by r236221, I'll add the test.

[Bug c++/70077] noexcept, inheriting constructors and the invalid use of an incomplete type that is actually complete

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70077

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-14
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #5 from Marek Polacek  ---
Confirmed with trunk:

$ ./cc1plus -quiet 70077.C
70077.C:8:31: error: invalid use of incomplete type ‘struct D’
8 | D() noexcept(noexcept(D{42})): B{42} { }
  |   ^
70077.C:6:8: note: definition of ‘struct D’ is not complete until the closing
brace
6 | struct D: public B {
  |^

[Bug c++/70156] incorrect "incomplete type" error initializing a static const data member

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70156

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #2 from Marek Polacek  ---
Since r254461:

70156.C:4:23: error: ‘constexpr’ needed for in-class initialization of static
data member ‘const A<0> C::a’ of non-integral type [-fpermissive]
4 | static const A<0> a = { 0 };
  |   ^
70156.C:5:20: error: ‘constexpr’ needed for in-class initialization of static
data member ‘const B C::b’ of non-integral type [-fpermissive]
5 | static const B b = { 1 };
  |^

which is also what clang++ says.  I'll add the test.

[Bug c++/78615] error: cannot decrement a pointer to incomplete type

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78615

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek  ---
This is again accepted starting with r245612.  I haven't figured out yet if
it's valid or not (and whether we should add the test).

[Bug c++/90462] Internal compiler error with deprecated-copy and json diagnostics

2019-05-14 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90462

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-14
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug c++/90449] No way to turn off warning about inaccessible base

2019-05-13 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90449

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c++/90426] [P0732] Error constructing non-type template parameter from a prvalue

2019-05-13 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90426

--- Comment #6 from Marek Polacek  ---
I posted a patch to improve diagnostics for this particular case:
https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00529.html

[Bug c++/90432] [9/10 Regression] Internal compiler error with no_unique_address empty type with constructor call followed by value initialized to non-zero

2019-05-13 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90432

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek  ---
Started with r268368.

[Bug c++/90426] [P0732] Error constructing non-type template parameter from a prvalue

2019-05-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90426

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Marek Polacek  ---
I think this is invalid.  [temp.arg]p2:
"In a template-argument, an ambiguity between a type-id and an expression is
resolved to a type-id, regardless of the form of the corresponding
template-parameter."

template
struct S { };

struct R { };

void
g (void)
{
  S s; // template argument treated as function type
  S s2;
  S s3; // template argument treated as function type
  S s4;
}

[Bug c++/90426] [P0732] Error constructing non-type template parameter from a prvalue

2019-05-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90426

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
This compiles if I use {} instead of ():

struct gram : unit {};

[Bug c++/78010] --Wsuggest-override reports a redundant warning on a 'final' method

2019-05-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Marek Polacek  ---
Fixed for 9.2 and 10.

[Bug c++/78010] --Wsuggest-override reports a redundant warning on a 'final' method

2019-05-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

--- Comment #11 from Marek Polacek  ---
Author: mpolacek
Date: Fri May 10 14:57:22 2019
New Revision: 271066

URL: https://gcc.gnu.org/viewcvs?rev=271066=gcc=rev
Log:
PR c++/78010 - bogus -Wsuggest-override warning on final function.
* class.c (check_for_override): Don't warn for final functions.

* g++.dg/warn/Wsuggest-override-2.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/warn/Wsuggest-override-2.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/class.c

[Bug c++/78010] --Wsuggest-override reports a redundant warning on a 'final' method

2019-05-10 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

--- Comment #10 from Marek Polacek  ---
Author: mpolacek
Date: Fri May 10 14:53:30 2019
New Revision: 271065

URL: https://gcc.gnu.org/viewcvs?rev=271065=gcc=rev
Log:
PR c++/78010 - bogus -Wsuggest-override warning on final function.
* class.c (check_for_override): Don't warn for final functions.

* g++.dg/warn/Wsuggest-override-2.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wsuggest-override-2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/87847] spec_hasher::hash does not match with spec_hasher::equal

2019-05-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87847

--- Comment #4 from Marek Polacek  ---
Or maybe just

@@ -1879,6 +1888,9 @@ iterative_hash_template_arg (tree arg, hashval_t val)
return val;
   }

+case TEMPLATE_TEMPLATE_PARM:
+  return val;
+
 default:
   break;
 }

[Bug c++/87847] spec_hasher::hash does not match with spec_hasher::equal

2019-05-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87847

--- Comment #3 from Marek Polacek  ---
An idea would be to hash TEMPLATE_TEMPLATE_PARMs differently in
iterative_hash_template_arg: hash its TEMPLATE_TYPE_PARM_INDEX and
TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL, so that when they compare equal, they
hash equal.

[Bug c++/90393] [9/10 Regression] ICE in return statement with a conditional operator, one of the second and third arguments is throw, and the other is a const variable of a class with a nontrivial co

2019-05-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90393

Marek Polacek  changed:

   What|Removed |Added

   Target Milestone|--- |9.2

[Bug c++/90393] [9/10 Regression] ICE in return statement with a conditional operator, one of the second and third arguments is throw, and the other is a const variable of a class with a nontrivial co

2019-05-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90393

--- Comment #2 from Marek Polacek  ---
Without const:

struct S {
S() = default;
S(const S&) {}
};

S f() {
S m;
return true ? m : throw 0;
}

int main() {}

I see a different ICE:

90393.C: In function ‘S f()’:
90393.C:8:29: internal compiler error: in gimplify_return_expr, at
gimplify.c:1542
8 | return true ? m : throw 0;
  | ^
0xf8cf19 gimplify_return_expr
/home/mpolacek/src/gcc/gcc/gimplify.c:1542
0xfbce53 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/mpolacek/src/gcc/gcc/gimplify.c:12725
0xf9e8de gimplify_stmt(tree_node**, gimple**)
/home/mpolacek/src/gcc/gcc/gimplify.c:6709
0xf9de25 gimplify_cleanup_point_expr
/home/mpolacek/src/gcc/gcc/gimplify.c:6452
0xfbd63e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/mpolacek/src/gcc/gcc/gimplify.c:12841
0xf9e8de gimplify_stmt(tree_node**, gimple**)
/home/mpolacek/src/gcc/gcc/gimplify.c:6709
0xf8deb3 gimplify_statement_list
/home/mpolacek/src/gcc/gcc/gimplify.c:1788
0xfbd9eb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/mpolacek/src/gcc/gcc/gimplify.c:12893
0xf9e8de gimplify_stmt(tree_node**, gimple**)
/home/mpolacek/src/gcc/gcc/gimplify.c:6709
0xf8c5c5 gimplify_bind_expr
/home/mpolacek/src/gcc/gcc/gimplify.c:1356
0xfbca9b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/mpolacek/src/gcc/gcc/gimplify.c:12665
0xf9e8de gimplify_stmt(tree_node**, gimple**)
/home/mpolacek/src/gcc/gcc/gimplify.c:6709
0xfc0419 gimplify_body(tree_node*, bool)
/home/mpolacek/src/gcc/gcc/gimplify.c:13673
0xfc0c0a gimplify_function_tree(tree_node*)
/home/mpolacek/src/gcc/gcc/gimplify.c:13817
0xd2b04f cgraph_node::analyze()
/home/mpolacek/src/gcc/gcc/cgraphunit.c:667
0xd2c9a2 analyze_functions
/home/mpolacek/src/gcc/gcc/cgraphunit.c:1126
0xd31a87 symbol_table::finalize_compilation_unit()
/home/mpolacek/src/gcc/gcc/cgraphunit.c:2837
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/90393] [9 Regression] ICE in return statement with a conditional operator, one of the second and third arguments is throw, and the other is a const variable of a class with a nontrivial copy

2019-05-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90393

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-05-08
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Started with r260272.

[Bug c++/87847] spec_hasher::hash does not match with spec_hasher::equal

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87847

--- Comment #2 from Marek Polacek  ---
In the ttp23.C testcase we're comparing B and B.  In one case the
template argument is

 >>

and the other is

 >>

same_type_p says they're same, so comp_template_args returns true.  One of the
template_template_parms has TYPE_CANONICAL, so we hash it as:

 1905   if (TYPE_CANONICAL (arg))
 1906 return iterative_hash_object (TYPE_HASH (TYPE_CANONICAL (arg)),
 1907   val);

but the other type doesn't have a canonical type:

 1910   /* Otherwise just compare the types during lookup.  */
 1911   return val;

so the hashes end up being different.

[Bug c++/87145] [7/8 Regression] Implicit conversion to scoped enum fails: "error: taking address of temporary/rvalue"

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87145

--- Comment #13 from Marek Polacek  ---
(In reply to Jö from comment #12)
> Just to be get this straight: "no backport possible" means this won't be
> fixed at all for 7 and 8, correct?

If it's important, I could actually fix it for GCC 8.4 too.  I just didn't know
how important this is.

[Bug c++/89214] [7/8 Regression] ICE in digest_init_r, at cp/typeck2.c:1211 with -std=c++17

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89214

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Marek Polacek  ---
Fixed for 8.4.

[Bug c++/88857] [7/8 Regression] ICE in build_value_init

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88857

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Marek Polacek  ---
Fixed for 8.4.

[Bug c++/89876] [8 Regression] ICE in convert_like_real on decltype expression involving string conversion to char*

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89876

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Marek Polacek  ---
Fixed.

[Bug c++/89511] [7/8 Regression] ICE in push_using_decl_1, at cp/name-lookup.c:3845

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89511

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #14 from Marek Polacek  ---
Fixed for 8.4.

[Bug c++/89705] [7/8 Regression] ICE in convert_like_real, at cp/call.c:7334

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89705

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Marek Polacek  ---
Fixed for 8.4.

[Bug c++/89876] [8 Regression] ICE in convert_like_real on decltype expression involving string conversion to char*

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89876

--- Comment #6 from Marek Polacek  ---
Author: mpolacek
Date: Tue May  7 16:29:39 2019
New Revision: 270974

URL: https://gcc.gnu.org/viewcvs?rev=270974=gcc=rev
Log:
PR c++/89876 - ICE with deprecated conversion.
* call.c (convert_like_real): Only give warnings with tf_warning.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/warn/conv5.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/call.c

[Bug c++/89705] [7/8 Regression] ICE in convert_like_real, at cp/call.c:7334

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89705

--- Comment #8 from Marek Polacek  ---
Author: mpolacek
Date: Tue May  7 16:28:11 2019
New Revision: 270973

URL: https://gcc.gnu.org/viewcvs?rev=270973=gcc=rev
Log:
PR c++/89705 - ICE with reference binding with conversion function.
* call.c (reference_binding): If the result of the conversion function
is a prvalue of non-class type, use the cv-unqualified type.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/rv-conv2.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/call.c

[Bug c++/89511] [7/8 Regression] ICE in push_using_decl_1, at cp/name-lookup.c:3845

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89511

--- Comment #13 from Marek Polacek  ---
Author: mpolacek
Date: Tue May  7 16:26:38 2019
New Revision: 270972

URL: https://gcc.gnu.org/viewcvs?rev=270972=gcc=rev
Log:
PR c++/89511 - ICE with using-declaration and unscoped enumerator.
* parser.c (cp_parser_using_declaration): For an unscoped enum
only use its context if it's not a function declaration.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/using-enum-3.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/parser.c

[Bug c++/89214] [7/8 Regression] ICE in digest_init_r, at cp/typeck2.c:1211 with -std=c++17

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89214

--- Comment #13 from Marek Polacek  ---
Author: mpolacek
Date: Tue May  7 16:25:26 2019
New Revision: 270971

URL: https://gcc.gnu.org/viewcvs?rev=270971=gcc=rev
Log:
PR c++/89214 - ICE when initializing aggregates with bases.
* typeck2.c (digest_init_r): Warn about object slicing instead of
crashing.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1z/aggr-base8.C
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp1z/aggr-base9.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/typeck2.c

[Bug c++/88857] [7/8 Regression] ICE in build_value_init

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88857

--- Comment #10 from Marek Polacek  ---
Author: mpolacek
Date: Tue May  7 16:23:19 2019
New Revision: 270970

URL: https://gcc.gnu.org/viewcvs?rev=270970=gcc=rev
Log:
PR c++/88857 - ICE with value-initialization of argument in template.
* call.c (convert_like_real): Don't call build_value_init in template.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/cpp0x/initlist-value4.C
Modified:
branches/gcc-8-branch/gcc/cp/ChangeLog
branches/gcc-8-branch/gcc/cp/call.c

[Bug c++/87145] [7/8 Regression] Implicit conversion to scoped enum fails: "error: taking address of temporary/rvalue"

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87145

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Marek Polacek  ---
GCC 8 doesn't have CONSTRUCTOR_IS_DEPENDENT so I guess I won't backport it.

[Bug c++/61990] Incorrect caret location for type mismatches in function calls

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61990

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
We now print:

61990.C: In function ‘void test(foo*)’:
61990.C:9:18: error: cannot convert ‘foo*’ to ‘bar*’
9 |   some_fn (f, f, f, f, f);
  |  ^
  |  |
  |  foo*
61990.C:5:36: note:   initializing argument 3 of ‘void some_fn(foo*, foo*,
bar*, foo*, foo*)’
5 | extern void some_fn (foo *, foo *, bar *, foo *, foo *);
  |^


so fixed.

[Bug c++/89612] [7/8 Regression] internal compiler error: in push_access_scope, at cp/pt.c:237

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89612

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Marek Polacek  ---
Fixed.

[Bug c++/81933] [7 Regression] Invalid "constexpr call flows off the end of the function" error

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81933

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Marek Polacek  ---
Fixed.

[Bug c/78666] conflicting attribute alloc_size accepted

2019-05-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78666

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|mpolacek at gcc dot gnu.org|unassigned at gcc dot 
gnu.org

[Bug c++/78010] --Wsuggest-override reports a redundant warning on a 'final' method

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #9 from Marek Polacek  ---
This can't be too hard to fix; let me try.

[Bug sanitizer/90347] [UBSAN] __attribute__((weak))__ results in "declared weak after being used" error

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90347

--- Comment #3 from Marek Polacek  ---
ubsan_maybe_instrument_reference_or_call sets
flag_delete_null_pointer_checks = 1;
and then we call tree_single_nonzero_warnv_p -> maybe_nonzero_address ->
symtab_node::nonzero_address

1979   if (!DECL_WEAK (decl)
1980   && flag_delete_null_pointer_checks)
1981 {
1982   refuse_visibility_changes = true;
1983   return true;
1984 }

[Bug sanitizer/90347] [UBSAN] __attribute__((weak))__ results in "declared weak after being used" error

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90347

--- Comment #2 from Marek Polacek  ---
Caused by -fsanitize=null.

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Marek Polacek  ---
Fixed.

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

--- Comment #7 from Marek Polacek  ---
Author: mpolacek
Date: Mon May  6 17:08:08 2019
New Revision: 270919

URL: https://gcc.gnu.org/viewcvs?rev=270919=gcc=rev
Log:
PR c++/90265 - ICE with generic lambda.
* pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
element in the vector.

* g++.dg/cpp1y/lambda-generic-90265.C: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/g++.dg/cpp1y/lambda-generic-90265.C
Modified:
branches/gcc-9-branch/gcc/cp/ChangeLog
branches/gcc-9-branch/gcc/cp/pt.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

--- Comment #5 from Marek Polacek  ---
Author: mpolacek
Date: Mon May  6 16:56:39 2019
New Revision: 270917

URL: https://gcc.gnu.org/viewcvs?rev=270917=gcc=rev
Log:
PR c++/90265 - ICE with generic lambda.
* pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
element in the vector.

* g++.dg/cpp1y/lambda-generic-90265.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-90265.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #4 from Marek Polacek  ---
Posted.

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

--- Comment #3 from Marek Polacek  ---
This fixes it:

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18881,7 +18881,8 @@ tsubst_copy_and_build (tree t,
if (thisarg)
  {
/* Shift the other args over to make room.  */
-   vec_safe_push (call_args, (*call_args)[nargs-1]);
+   tree last = (*call_args)[nargs - 1];
+   vec_safe_push (call_args, last);
for (int i = nargs-1; i > 0; --i)
  (*call_args)[i] = (*call_args)[i-1];
(*call_args)[0] = thisarg;

[Bug rtl-optimization/90319] [C++17] aggregate initialization of base: ICE in assign_temp

2019-05-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90319

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
Started with r241187.

[Bug c++/90265] [9/10 Regression] ICE in build_call_a at gcc/cp/call.c:396 since r268377

2019-05-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90265

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed|2019-04-26 00:00:00 |2019-05-02
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c++/90254] [8/9 Regression] ice on aggregate initialization of unmovable base

2019-04-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90254

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Priority|P3  |P2
   Target Milestone|--- |8.4
Summary|ice on aggregate|[8/9 Regression] ice on
   |initialization of unmovable |aggregate initialization of
   |base|unmovable base

[Bug c++/90254] ice on aggregate initialization of unmovable base

2019-04-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90254

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-25
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Started with r247757.

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #4 from Marek Polacek  ---
Concluded we'll leave 8 as-is.  This is not a regression.

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Wed Apr 24 21:28:04 2019
New Revision: 270557

URL: https://gcc.gnu.org/viewcvs?rev=270557=gcc=rev
Log:
PR c++/90236
* g++.dg/cpp1z/nontype-auto16.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1z/nontype-auto16.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

--- Comment #2 from Marek Polacek  ---
Clearly it's this hunk:

@@ -6985,27 +7071,10 @@ convert_nontype_argument (tree type, tree expr,
tsubst_flags_t complain)
   itself value-dependent, since what we want here is its address.  */;
   else
{
- if (!DECL_P (expr))
-   {
- if (complain & tf_error)
-   error ("%qE is not a valid template argument for type %qT "
-  "because it is not an object with linkage",
-  expr, type);
- return NULL_TREE;
-   }
-
- /* DR 1155 allows internal linkage in C++11 and up.  */
- linkage_kind linkage = decl_linkage (expr);
- if (linkage < (cxx_dialect >= cxx11 ? lk_internal : lk_external))
-   {
- if (complain & tf_error)
-   error ("%qE is not a valid template argument for type %qT "
-  "because object %qD does not have linkage",
-  expr, type, expr);
- return NULL_TREE;
-   }
-
  expr = build_address (expr);
+
+ if (invalid_tparm_referent_p (type, expr, complain))
+   return NULL_TREE;
}

   if (!same_type_p (type, TREE_TYPE (expr)))

[Bug c++/90236] bogus error with auto non-type template argument

2019-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90236

Marek Polacek  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Target Milestone|--- |7.5

--- Comment #1 from Marek Polacek  ---
g++7 also fails the same.

(Thanks Hana for providing the testcase!)

  1   2   3   4   5   6   7   8   9   10   >