[Bug c++/57136] New: Should redeclaration of class template with function pointer rather than function be an error?

2013-05-01 Thread kjw.chiu at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57136



 Bug #: 57136

   Summary: Should redeclaration of class template with function

pointer rather than function be an error?

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: minor

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: kjw.c...@gmail.com





'g++ -std=c++11 -Wall' compiles this without complaint:



template  class A;

template  class A;



template  class B;

template  class B;



clang++ issues an error for the redeclaration of class

B, but not for the redeclaration of class A.  I filed

this as a bug at LLVM, where I was told that this is

correct, and that the rule is, if I understood it

correctly:



If a template parameter depends on a previous

template parameter, then it must be token-by-token

equivalent in any redeclaration.



I simply filing here for informative purposes.  I have

not attempted to confirm this in the C++11

specification.


[Bug c++/57092] New: Using decltype of function pointer type to define a data member causes compiler crash

2013-04-27 Thread kjw.chiu at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57092



 Bug #: 57092

   Summary: Using decltype of function pointer type to define a

data member causes compiler crash

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: kjw.c...@gmail.com





This code:



template 

class B {

decltype(F) v;

};



void foo(int) {}



int main() {

B o;

}



causes this crash:



$ g++ -std=c++11 bug.cpp

bug.cpp: In instantiation of 'class B':

bug.cpp:9:12:   required from here

bug.cpp:3:17: internal compiler error: in finish_decltype_type, at

cp/semantics.c:5365

 decltype(F) v;

 ^

0x5a6230 finish_decltype_type(tree_node*, bool, int)

../../src/gcc/cp/semantics.c:5365

0x521c5c tsubst(tree_node*, tree_node*, int, tree_node*)

../../src/gcc/cp/pt.c:11772

0x51fe2e tsubst_decl

../../src/gcc/cp/pt.c:10450

0x5218a7 tsubst(tree_node*, tree_node*, int, tree_node*)

../../src/gcc/cp/pt.c:11081

0x52f177 instantiate_class_template_1

../../src/gcc/cp/pt.c:8818

0x52f177 instantiate_class_template(tree_node*)

../../src/gcc/cp/pt.c:9054

0x57ce2d complete_type(tree_node*)

../../src/gcc/cp/typeck.c:131

0x4ff471 start_decl_1(tree_node*, bool)

../../src/gcc/cp/decl.c:4662

0x50d294 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,

tree_node*, tree_node*, tree_node**)

../../src/gcc/cp/decl.c:4625

0x572b98 cp_parser_init_declarator

../../src/gcc/cp/parser.c:15914

0x5734ce cp_parser_simple_declaration

../../src/gcc/cp/parser.c:10567

0x56edd0 cp_parser_block_declaration

../../src/gcc/cp/parser.c:10448

0x56fdf0 cp_parser_declaration_statement

../../src/gcc/cp/parser.c:10092

0x570497 cp_parser_statement

../../src/gcc/cp/parser.c:8867

0x57167e cp_parser_statement_seq_opt

../../src/gcc/cp/parser.c:9139

0x57179e cp_parser_compound_statement

../../src/gcc/cp/parser.c:9093

0x5718e8 cp_parser_function_body

../../src/gcc/cp/parser.c:17680

0x5718e8 cp_parser_ctor_initializer_opt_and_function_body

../../src/gcc/cp/parser.c:17716

0x57252f cp_parser_function_definition_after_declarator

../../src/gcc/cp/parser.c:21691

0x573143 cp_parser_function_definition_from_specifiers_and_declarator

../../src/gcc/cp/parser.c:21612

Please submit a full bug report,

with preprocessed source if appropriate.

Please include the complete backtrace with any bug report.

See  for instructions.