[Bug c++/89878] same specializations on a zero-initialized struct object as a non-type parameter treated as distinct

2019-04-04 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89878

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |9.0

--- Comment #4 from Martin Sebor  ---
Fixed in r270155.

[Bug c++/89878] same specializations on a zero-initialized struct object as a non-type parameter treated as distinct

2019-04-04 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89878

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Thu Apr  4 23:10:23 2019
New Revision: 270155

URL: https://gcc.gnu.org/viewcvs?rev=270155&root=gcc&view=rev
Log:
PR c++/89974 - ICE on a definition of a non-type specialization on a struct
object with pointer to member function
PR c++/89878 - same specializations on a zero-initialized struct object as a
non-type parameter treated as distinct
PR c++/89833 - sorry, unimplemented: string literal in function template
signature
PR c++/47488 - sorry, unimplemented: string literal in function template
signature

gcc/cp/ChangeLog:

PR c++/89974
PR c++/89878
PR c++/89833
PR c++/47488
* decl.c (reshape_init_array_1): Strip trailing zero-initializers
from arrays of trivial type and known size.
* mangle.c (write_expression): Convert braced initializer lists
to STRING_CSTs.
(write_expression): Trim trailing zero-initializers from arrays
of trivial type.
(write_template_arg_literal): Mangle strings the same as braced
initializer lists.

gcc/testsuite/ChangeLog:

PR c++/89974
PR c++/89878
PR c++/89833
PR c++/47488
* gcc/testsuite/g++.dg/abi/mangle69.C: New test.
* gcc/testsuite/g++.dg/abi/mangle70.C: New test.
* gcc/testsuite/g++.dg/abi/mangle71.C: New test.
* gcc/testsuite/g++.dg/abi/mangle72.C: New test.
* gcc/testsuite/g++.dg/cpp0x/constexpr-array19.C: New test.
* gcc/testsuite/g++.dg/cpp2a/nontype-class15.C: New test.
* gcc/testsuite/g++.dg/cpp2a/nontype-class16.C: New test.
* gcc/testsuite/g++.dg/init/array51.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/abi/mangle69.C
trunk/gcc/testsuite/g++.dg/abi/mangle70.C
trunk/gcc/testsuite/g++.dg/abi/mangle71.C
trunk/gcc/testsuite/g++.dg/abi/mangle72.C
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array19.C
trunk/gcc/testsuite/g++.dg/cpp2a/nontype-class15.C
trunk/gcc/testsuite/g++.dg/cpp2a/nontype-class16.C
trunk/gcc/testsuite/g++.dg/init/array51.C
trunk/gcc/testsuite/g++.dg/template/nontype29.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/cp/mangle.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/89878] same specializations on a zero-initialized struct object as a non-type parameter treated as distinct

2019-04-03 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89878

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-04-03
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=89833
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2019-04/msg0.html

[Bug c++/89878] same specializations on a zero-initialized struct object as a non-type parameter treated as distinct

2019-03-31 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89878

Martin Sebor  changed:

   What|Removed |Added

   Keywords||rejects-valid

--- Comment #1 from Martin Sebor  ---
The converse of accepting multiple definitions of the same symbol is that valid
redeclarations of the same symbol are rejected as shown in the test case below:

$ cat z.C && gcc -c -Wall -std=c++2a z.C
struct A1 { char c[5]; };

template  struct B { };

typedef B  A_A;
typedef B   A_AZ___;
typedef BA_AZZ__;
typedef B A_AZZZ_;
typedef B  A_A;

extern A_A same_type_B_A1_A;
extern A_AZ___ same_type_B_A1_A;
extern A_AZZ__ same_type_B_A1_A;
extern A_AZZZ_ same_type_B_A1_A;
extern A_A same_type_B_A1_A;
z.C:12:16: error: conflicting declaration ‘A_AZ___ same_type_B_A1_A’
   12 | extern A_AZ___ same_type_B_A1_A;
  |^~~~
z.C:11:16: note: previous declaration as ‘A_A same_type_B_A1_A’
   11 | extern A_A same_type_B_A1_A;
  |^~~~
z.C:13:16: error: conflicting declaration ‘A_AZZ__ same_type_B_A1_A’
   13 | extern A_AZZ__ same_type_B_A1_A;
  |^~~~
z.C:11:16: note: previous declaration as ‘A_A same_type_B_A1_A’
   11 | extern A_A same_type_B_A1_A;
  |^~~~
z.C:14:16: error: conflicting declaration ‘A_AZZZ_ same_type_B_A1_A’
   14 | extern A_AZZZ_ same_type_B_A1_A;
  |^~~~
z.C:11:16: note: previous declaration as ‘A_A same_type_B_A1_A’
   11 | extern A_A same_type_B_A1_A;
  |^~~~
z.C:15:16: error: conflicting declaration ‘A_A same_type_B_A1_A’
   15 | extern A_A same_type_B_A1_A;
  |^~~~
z.C:11:16: note: previous declaration as ‘A_A same_type_B_A1_A’
   11 | extern A_A same_type_B_A1_A;
  |^~~~