[Bug c++/68828] New: [concepts] ICE in fold with requires and function call around parameters

2015-12-09 Thread jarrydb at cse dot unsw.edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68828

Bug ID: 68828
   Summary: [concepts] ICE in fold with requires and function call
around parameters
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jarrydb at cse dot unsw.edu.au
  Target Milestone: ---

The following causes r231384 to ICE

template 
struct Var
{
};

struct A
{
};

template 
T
forward(T t)
{
  return static_cast(t);
}

template 
bool requires_types_args(V&& v, Var&, Args&&... args)
{
  return (true && ... &&
requires (V&& v, Types type, Args... args) {
  foo(forward(v), forward(type), 
forward(args)...);
}
  );
}

void bar()
{
  Var<int, char> v;
  requires_types_args(A(), v, 1, 'b');
}


Error is:

g++ -std=c++1z fold-ice3.cpp
fold-ice3.cpp: In instantiation of ‘bool requires_types_args(V&&, Var&, Args&& ...) [with V = A; Types = int, char; Args = {int, char}]’:
fold-ice3.cpp:31:37:   required from here
fold-ice3.cpp:22:10: error: ‘foo’ was not declared in this scope
   foo(forward(v), forward(type),
   ~~~^
 forward(args)...);
 ~~~

fold-ice3.cpp:22:10: error: ‘foo’ was not declared in this scope, and no
declarations were found by argument-dependent lookup at the point of
instantiation [-fpermissive]
fold-ice3.cpp:22:10: note: ‘foo’ declared here, later in the translation unit
fold-ice3.cpp:26:1: internal compiler error: tree check: expected tree that
contains ‘typed’ structure, have ‘simple_req’ in cp_fold, at
cp/cp-gimplify.c:1948
 }
 ^

0xf62e24 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../../src/gcc-git/gcc/tree.c:9771
0x7f610c contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../../src/gcc-git/gcc/tree.h:3111
0x7f610c cp_fold
../../../src/gcc-git/gcc/cp/cp-gimplify.c:1948
0x7f6620 cp_fold_r
../../../src/gcc-git/gcc/cp/cp-gimplify.c:941
0xf85d82 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../../src/gcc-git/gcc/tree.c:11492
0xf85ecd walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../../src/gcc-git/gcc/tree.c:11539
0x79fb18 cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**, int*,
void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*)
../../../src/gcc-git/gcc/cp/tree.c:3895
0xf85df8 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../../src/gcc-git/gcc/tree.c:11515
0xf861d6 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../../src/gcc-git/gcc/tree.c:11809
0x612eaf finish_function(int)
../../../src/gcc-git/gcc/cp/decl.c:14589
0x641eaf instantiate_decl(tree_node*, int, bool)
../../../src/gcc-git/gcc/cp/pt.c:21802
0x687c7b instantiate_pending_templates(int)
../../../src/gcc-git/gcc/cp/pt.c:21897
0x6c8ef1 c_parse_final_cleanups()
../../../src/gcc-git/gcc/cp/decl2.c:4579
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/68826] New: [concepts] ICE in fold expression with requires

2015-12-09 Thread jarrydb at cse dot unsw.edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68826

Bug ID: 68826
   Summary: [concepts] ICE in fold expression with requires
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jarrydb at cse dot unsw.edu.au
  Target Milestone: ---

r231384

ICE in the fold expression in the following code:

template 
bool requires_types(Types&&... types)
{
  return (true && ... &&
requires { foo(types); });
}

void bar()
{
  requires_types('c', 1, "hi");
}


The error is:

g++ -std=c++1z fold-ice1.cpp -c
fold-ice1.cpp: In instantiation of ‘bool requires_types(Types&& ...) [with
Types = {char, int, const char (&)[3]}]’:
fold-ice1.cpp:10:30:   required from here
fold-ice1.cpp:5:19: internal compiler error: in tsubst_copy, at cp/pt.c:13729
 requires { foo(types); });
~~~^~~

0x64d155 tsubst_copy
../../../src/gcc-git/gcc/cp/pt.c:13729
0x64e560 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16822
0x650303 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16312
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x82133c tsubst_simple_requirement
../../../src/gcc-git/gcc/cp/constraint.cc:1580
0x82133c tsubst_requirement
../../../src/gcc-git/gcc/cp/constraint.cc:1636
0x82133c tsubst_requirement_body
../../../src/gcc-git/gcc/cp/constraint.cc:1659
0x82133c tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
../../../src/gcc-git/gcc/cp/constraint.cc:1690
0x64f690 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16980
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x66176b gen_elem_of_pack_expansion_instantiation
../../../src/gcc-git/gcc/cp/pt.c:10514
0x66176b tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../../src/gcc-git/gcc/cp/pt.c:10944
0x64b69c tsubst_fold_expr_pack
../../../src/gcc-git/gcc/cp/pt.c:10604
0x64b69c tsubst_binary_left_fold
../../../src/gcc-git/gcc/cp/pt.c:10661
0x64b69c tsubst_copy
../../../src/gcc-git/gcc/cp/pt.c:14303
0x650248 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16058
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x644457 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:14940
0x644f9b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15116
0x641e06 instantiate_decl(tree_node*, int, bool)
../../../src/gcc-git/gcc/cp/pt.c:21780
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/68827] New: [concepts] ICE in fold where requires parameter shadows function argument

2015-12-09 Thread jarrydb at cse dot unsw.edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68827

Bug ID: 68827
   Summary: [concepts] ICE in fold where requires parameter
shadows function argument
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jarrydb at cse dot unsw.edu.au
  Target Milestone: ---

The following code causes an ICE in r231384

template 
struct Var
{
};

struct A
{
};

template 
bool requires_types_args(V&& v, Var&, Args&&... args)
{
  return (true && ... &&
requires (V&& v, Types... type, Args... args) {
  foo(v, type, args...);
}
  );
}

void bar()
{
  Var<int, char> v;
  requires_types_args(A(), v, 1, 'b');
}


g++ -std=c++1z fold-ice2.cpp -c
fold-ice2.cpp: In instantiation of ‘bool requires_types_args(V&&, Var&, Args&& ...) [with V = A; Types = {int, char}; Args = {int, char}]’:
fold-ice2.cpp:23:37:   required from here
fold-ice2.cpp:15:10: internal compiler error: in arg_assoc_type, at
cp/name-lookup.c:5570
   foo(v, type, args...);
   ~~~^~

0x7dd593 arg_assoc_type
../../../src/gcc-git/gcc/cp/name-lookup.c:5570
0x7ddea1 arg_assoc_args_vec
../../../src/gcc-git/gcc/cp/name-lookup.c:5596
0x7ddea1 lookup_arg_dependent_1
../../../src/gcc-git/gcc/cp/name-lookup.c:5701
0x7ddea1 lookup_arg_dependent(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>*)
../../../src/gcc-git/gcc/cp/name-lookup.c:5729
0x77c429 perform_koenig_lookup(cp_expr, vec<tree_node*, va_gc, vl_embed>*, int)
../../../src/gcc-git/gcc/cp/semantics.c:2215
0x650ef5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16353
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x82133c tsubst_simple_requirement
../../../src/gcc-git/gcc/cp/constraint.cc:1580
0x82133c tsubst_requirement
../../../src/gcc-git/gcc/cp/constraint.cc:1636
0x82133c tsubst_requirement_body
../../../src/gcc-git/gcc/cp/constraint.cc:1659
0x82133c tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
../../../src/gcc-git/gcc/cp/constraint.cc:1690
0x64f690 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16980
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x6617ad tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../../src/gcc-git/gcc/cp/pt.c:10919
0x64b69c tsubst_fold_expr_pack
../../../src/gcc-git/gcc/cp/pt.c:10604
0x64b69c tsubst_binary_left_fold
../../../src/gcc-git/gcc/cp/pt.c:10661
0x64b69c tsubst_copy
../../../src/gcc-git/gcc/cp/pt.c:14303
0x650248 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../../src/gcc-git/gcc/cp/pt.c:16058
0x6451ac tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:15628
0x644457 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../../src/gcc-git/gcc/cp/pt.c:14940
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/68781] New: [concepts] requires in member function is not unevaluated

2015-12-07 Thread jarrydb at cse dot unsw.edu.au
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68781

Bug ID: 68781
   Summary: [concepts] requires in member function is not
unevaluated
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jarrydb at cse dot unsw.edu.au
  Target Milestone: ---

The following correct code fails to compile in r231384

template 
struct declval_helper
{
static constexpr bool stop = false;
static T value();
};

template 
T
declval()
{
static_assert(declval_helper::stop, "declval must not be used");
return declval_helper::value();
}

template 
struct A {
static void foo(int);
};

void bar(int);

template 
requires requires {
bar(declval());
}
void foo(T t) {
}

class Foo {

public:

template 
requires requires {
bar(declval());
}
void foo(T t) {
}

};

void test() {
Foo f;
f.foo(5);

foo(5);
}

with the error:

g++ -std=c++1z uneval.cpp -c
uneval.cpp: In instantiation of ‘T declval() [with T = int]’:
uneval.cpp:36:27:   required by substitution of ‘template  requires
predicate(requires{bar()((declval)());}) void Foo::foo(T) [with T = int]’
uneval.cpp:45:12:   required from here
uneval.cpp:12:5: error: static assertion failed: declval must not be used
 static_assert(declval_helper::stop, "declval must not be used");
 ^

Note that commenting out the line f.foo(5); works fine. So it is only a problem
for member functions.

[Bug c++/52699] New: infinite loop generated with -O0

2012-03-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52699

 Bug #: 52699
   Summary: infinite loop generated with -O0
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


[Bug c++/52699] infinite loop generated with -O0

2012-03-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52699

Jarryd Beck jarrydb at cse dot unsw.edu.au changed:

   What|Removed |Added

 Target||i686-pc-linux-gnu
   Host||i686-pc-linux-gnu
  Build||i686-pc-linux-gnu

--- Comment #1 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2012-03-24 
07:54:23 UTC ---
When the attached file is compiled with no optimisation, the resulting program
never terminates.

  g++ -std=gnu++11 random.cpp

If I compile it with:

  g++ -std=gnu++11 random.cpp -O1

then it works.

The program is as follows, fully preprocessed sources are attached.

#include random

typedef std::mt19937::result_type unit_type;
typedef std::independent_bits_engine

  std::mt19937,
  sizeof(unit_type)*8,
  unit_type
 full_bits_generator;

int main()
{
  full_bits_generator gen;

  gen();
  return 0;
}

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarryd/local/gcc-4.8/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /home/jarryd/git/gcc-git/configure
--prefix=/home/jarryd/local/gcc-4.8 --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120323 (experimental) (GCC)


[Bug c++/52699] infinite loop generated with -O0

2012-03-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52699

--- Comment #2 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2012-03-24 
07:55:16 UTC ---
Created attachment 26972
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26972
this file never terminates with -O0


[Bug c++/52699] infinite loop generated with -O0

2012-03-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52699

--- Comment #3 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2012-03-24 
07:56:15 UTC ---
Created attachment 26973
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26973
The preprocessed version


[Bug c++/52699] infinite loop generated with -O0

2012-03-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52699

--- Comment #4 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2012-03-24 
07:57:20 UTC ---
Note that this appears to happen only on 32 bit.


[Bug c++/51299] New: [C++11] erroneous nullptr warning on dynamic cast

2011-11-24 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51299

 Bug #: 51299
   Summary: [C++11] erroneous nullptr warning on dynamic cast
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


The below code compiled with -Wzero-as-null-pointer-constant produces an
erroneous warning on a dynamic cast.

g++ -std=gnu++11 nullcast.cpp -c -Wzero-as-null-pointer-constant
nullcast.cpp: In function ‘void foo(Base*)’:
nullcast.cpp:13:40: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
nullcast.cpp:13:40: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]

class Base
{
  public:
  virtual ~Base() = default;
};

class Derived : public Base
{
};

void foo(Base *b)
{
  Derived *d = dynamic_castDerived*(b);
}

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 2025 (experimental) (GCC)


[Bug c++/51080] New: [C++11] constexpr function array size error

2011-11-10 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51080

 Bug #: 51080
   Summary: [C++11] constexpr function array size error
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


The program below fails to compile with the following error:

g++ -c constexpr-array.cpp -std=gnu++11
constexpr-array.cpp:4:25: error: size of array ‘data’ is not an integral
constant-expression


class A
{
  static constexpr int static_size() { return 16; }
  int data[static_size()];
};


Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarryd/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarryd/current/soft/src/gcc-git/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 2009 (experimental) (GCC)


[Bug c++/51045] New: [C++0x] erroneous zero as null pointer constant warning at delete

2011-11-08 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51045

 Bug #: 51045
   Summary: [C++0x] erroneous zero as null pointer constant
warning at delete
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


The attached code erroneously gives me a warning about using zero as a null
pointer constant where there is no zero at all. The line it points to is a
delete statement.

g++ -std=gnu++11 zeronull.cpp -c -Wzero-as-null-pointer-constant
zeronull.cpp: In instantiation of ‘AT::~A() [with T = Op]’:
zeronull.cpp:12:7:   required from here
zeronull.cpp:7:5: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]


gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++ : (reconfigured)
/home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 2008 (experimental) (GCC)


[Bug c++/51045] [C++0x] erroneous zero as null pointer constant warning at delete

2011-11-08 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51045

--- Comment #1 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-11-09 
02:15:34 UTC ---
Created attachment 25762
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25762
erroneous zero as null pointer warning


[Bug c++/50972] New: [C++0x] ICE on undeclared identifier

2011-11-02 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50972

 Bug #: 50972
   Summary: [C++0x] ICE on undeclared identifier
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


Created attachment 25698
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25698
triggers an internal compiler error

The attached code fails causes an internal compiler error. I reduced it to
about 500 lines. The error now isn't the original error, but they both seem to
come from an undeclared identifier. The relevant line is:

ice-undeclared.ii:275:7: error: ‘_S_propagate_on_swap’ was not declared in this
scope

The error reported is:

ice-undeclared.ii: At global scope:
ice-undeclared.ii:473:21: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

Compiled with:

g++ -std=gnu++11 ice-undeclared.ii -c


gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 2002 (experimental) (GCC)


[Bug c++/50973] New: [C++11] internal compiler error defaulted destructor virtual inheritance

2011-11-02 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50973

 Bug #: 50973
   Summary: [C++11] internal compiler error defaulted destructor
virtual inheritance
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


The following code causes an internal compiler error:


class HD
{
  public:
  virtual ~HD() {};
};
class InputHD : public virtual HD
{
};
class OutputHD : public virtual HD
{
};
class IOHD : public InputHD, public OutputHD
{
};
template typename T, unsigned int N
class ArrayNHD : public IOHD
{
  public:
  ~ArrayNHD() = default;
};
class TLText
{
  ~TLText();
  ArrayNHDint, 1* m_argsHD;
};
TLText::~TLText()
{
  delete m_argsHD;
}


g++ -std=gnu++11 -c tltext-min4.ii

tltext-min4.ii:29:1: internal compiler error: in
function_and_variable_visibility, at ipa.c:869
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 2002 (experimental) (GCC)


[Bug c++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference

2011-10-31 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50929

--- Comment #2 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-10-31 
07:42:54 UTC ---
That's a shame, and rather annoying. I read pages and pages of the standard to
try to understand this one. Do you know where this is explained?

I added a non-const constructor and also tried it with a const object, they
worked as you said.


[Bug c++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference

2011-10-31 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50929

--- Comment #4 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-10-31 
10:07:04 UTC ---
I didn't realise that A(A) was a better match. I was thinking of C++ code
where you might write:

  template typename T
  A(const T t);

  A(const A rhs);

in which case A(const A) would be chosen. I didn't realise that the rvalue
reference puts a spanner in the works. I was reading the part about a template
function and a non-template function being candidates, and if the non-template
function is no worse than the template function then it is chosen. But I didn't
realise that in this case the non-template one is actually worse.

I suppose that the bug can probably be marked as invalid then.


[Bug c++/50929] [C++0x] Wrong function selected for overload with template and rvalue reference

2011-10-31 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50929

--- Comment #6 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-10-31 
10:34:16 UTC ---
Yeah I understand now. Basically having a perfect forwarding constructor means
that I need a non-const constructor if I want my example to work as I initially
said.


[Bug c++/50929] New: [C++0x] Wrong function selected for overload with template and rvalue reference

2011-10-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50929

 Bug #: 50929
   Summary: [C++0x] Wrong function selected for overload with
template and rvalue reference
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


When choosing between a constructor

  A(const A a)

and

  template typename T
  A(T t)

given an object of type A, the compiler chooses the second function. For the
following code:

class A
{
  public:
  A() : value(0) {}

  A(const A rhs) : value(1) { }

  A(A rhs) : value(2) { }

  template typename T
  A(T t) : value(3) { }

  int value;
};

int main()
{
  A a;
  A b = a;
  return b.value;
}

compiled with:
  g++ -std=gnu++0x rvalue_deduction.cpp

then running:
  ./a.out
  echo $?

the output is 
  3

I expect the output to be 1, not 3.


Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20111027 (experimental) (GCC)


[Bug c++/50893] New: [C++0x] explicitly defaulted virtual destructor throw specification

2011-10-28 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50893

 Bug #: 50893
   Summary: [C++0x] explicitly defaulted virtual destructor throw
specification
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


The following code fails to compile:

class Base
{
  public:
  virtual ~Base() = default;
};

class Derived : public Base
{
  public:
  virtual ~Derived() = default;
};

g++ -std=gnu++0x except.cpp 
except.cpp:10:11: error: looser throw specifier for ‘virtual
Derived::~Derived()’
except.cpp:4:11: error:   overriding ‘virtual Base::~Base() noexcept (true)’

I think, according to 15.4.14, that Derived should, by default, have the same
exception specification as Base, ie. noexcept(true). Therefore, this code
should compile.

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20111027 (experimental) (GCC)


[Bug c++/50711] New: [C++0x] substitution failure reports error with result_of

2011-10-12 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50711

 Bug #: 50711
   Summary: [C++0x] substitution failure reports error with
result_of
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


Created attachment 25479
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25479
substitution failure error

The attached file produces an error. I believe that the templated get
function should fail, leaving the non templated function as the only valid
choice, not reporting an error, but choosing the non templated function.

Compiled with:
g++ substitution.cpp -std=gnu++0x -save-temps

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20111011 (experimental) (GCC)


[Bug c++/50711] [C++0x] substitution failure reports error with result_of

2011-10-12 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50711

--- Comment #3 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-10-13 
03:32:05 UTC ---
The following code works:

struct Tuple
{
  int a, b, c;
};

struct array_get
{
  template typename T
  const T
  operator()(const T t)
  {
return t;
  }

  template typename Array, typename First, typename... Location
  auto
  operator()(const Array a, First f, Location... loc)
  //  - typename std::result_ofarray_get(decltype(a[f]), Location...)::type
- decltype(operator()(a[f], loc...))
  {
return operator()(a[f], loc...);
  }
};

struct Array
{
  int array[5][5][5];

  Array()
  {
for (int i = 0; i != 5*5*5; ++i)
{
  reinterpret_castint*(array)[i] = i;
}
  }

  int get(const Tuple t)
  {
return array[t.a][t.b][t.c];
  }

  template typename... Location
  //typename std::result_ofarray_get(int[5][5][5], Location...)::type
  auto
  get(Location... loc)
- decltype(array_get()(array, loc...))
  {
return array_get()(array, loc...);
  }
};

int main(int argc, char *argv[])
{
  Array a;
  Tuple t{3,4,1};
  //return a.get(1,2,3);
  return a.get(t);
}


[Bug c++/50391] New: [C++0x] ICE on invalid code, pair with incomplete type

2011-09-13 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50391

 Bug #: 50391
   Summary: [C++0x] ICE on invalid code, pair with incomplete type
Classification: Unclassified
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


This code produces an internal compile error:

compile with g++ --std=gnu++0x


#include utility

class Blob;

void
foo(Blob *b)
{
  auto p = std::make_pair(1, *b);
}


I'm using the latest svn version.

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++ : (reconfigured)
/home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++ : (reconfigured)
/home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110913 (experimental) (GCC)


[Bug c++/50020] New: [C++0x] internal compiler error range for in templated class

2011-08-07 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50020

   Summary: [C++0x] internal compiler error range for in templated
class
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


Created attachment 24947
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24947
range for in templated class error

Using built-in specs.
COLLECT_GCC=/home/jarrydb/current/soft/install-latest/bin/gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-git/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go
Thread model: posix
gcc version 4.7.0 20110807 (experimental) (GCC)

Using gcc svn revision 177550, this error:

init_list2.cpp: In member function ‘void AT, N::f(int, int)’:
init_list2.cpp:24:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

is produced by this code:

g++ init_list2.ii -std=gnu++0x

#include vector
#include cstdint
#include cstdlib

template typename T, size_t N
class A
{
  private:
  std::vectoruint16_t m_v;

  public:
  void
  f(int a, int b)
  {
for (auto v : m_v)
{
}
  }
};

int main()
{
  A a;
  return 0;
}

The full preprocessed source is attached.


[Bug c++/49983] New: Template types fail in range-based for.

2011-08-05 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49983

   Summary: Template types fail in range-based for.
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


The following code fails to compile with gcc revision 177356.

g++ -std=gnu++0x template-range.cpp

class A
{
  public:

  template typename List
  A(const List l)
  {
for (auto v : l)
{
}
  }
};


[Bug c++/49538] [4.7 regression] Revision 175341 causes segfaults

2011-07-10 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49538

--- Comment #10 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-07-10 
12:20:26 UTC ---
*** Bug 49587 has been marked as a duplicate of this bug. ***


[Bug c++/49587] Code generation error with dynamic libraries.

2011-07-10 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49587

Jarryd Beck jarrydb at cse dot unsw.edu.au changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution||DUPLICATE

--- Comment #6 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-07-10 
12:20:26 UTC ---
It is definitely a duplicate of bug 49538 which is fixed now, and my problem is
fixed. So I am marking this as resolved.

*** This bug has been marked as a duplicate of bug 49538 ***


[Bug c++/49538] [4.7 regression] Revision 175341 causes segfaults

2011-07-07 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49538

--- Comment #7 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-07-07 
21:55:06 UTC ---
I just wanted to comment here that I have also found this problem. I bisected
it to the same revision using my own project. I reported it as bug [[49587]].


[Bug c++/49538] [4.7 regression] Revision 175341 causes segfaults

2011-07-07 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49538

--- Comment #8 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-07-07 
21:58:45 UTC ---
Sorry I linked that wrongly, it's bug 49587.


[Bug c++/49587] New: Code generation error with dynamic libraries.

2011-06-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49587

   Summary: Code generation error with dynamic libraries.
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


I have a rather large piece of code (about 20,000 lines) which doesn't appear
to be compiled correctly. I can't reproduce the error, but I have found the
revision that breaks it, and I can describe roughly what the error is.

The last revision that works is 175340, it is broken in 175341.

Initially the bug surfaced as the instruction pointer trying to execute address
0x0. After further digging (with gdb, running instruction by instruction) I
discovered that at a function call, which was in a dynamic library, upon trying
to resolve the address of the function, it found that the function was at
address zero. It got to the particular function call, went through the dynamic
library lookup table, then it dies.


[Bug c++/49589] New: [C++0x] Internal compile error at decltype

2011-06-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49589

   Summary: [C++0x] Internal compile error at decltype
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
 Build: x86_64-unknown-linux-gnu


Created attachment 24643
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24643
ICE with decltype

The attached code causes the compiler to exit with a segmentation fault at a
use of decltype.

g++ --std=gnu++0x decltype_error_2.ii
decltype_error_2.cpp:45:31: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

output of gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarrydb/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarrydb/current/soft/src/gcc-svn/configure
--prefix=/home/jarrydb/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go
Thread model: posix
gcc version 4.7.0 20110630 (experimental) (GCC)


[Bug c++/49587] Code generation error with dynamic libraries.

2011-06-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49587

--- Comment #2 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-30 
10:16:58 UTC ---
I wish that I could give you a test case. I can't reproduce it on any small
piece of code. The only code that I can get it to break on is my project which
has about 20,000 lines of code. It has nearly 100 files and uses boost spirit.
It compiles into a library and several executables.

The compiler version I already stated. It's gcc svn, the first broken revision
is 175341 (maybe that wasn't clear).

The flags used for compiling are simply -fPIC for the library and nothing extra
for the executables.

Another thing to note is that I moved the function call in which the error
occurs to later in my code, and a different function bombed in exactly the same
way.

How would you like me to proceed?


[Bug c++/49587] Code generation error with dynamic libraries.

2011-06-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49587

--- Comment #3 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-30 
11:52:52 UTC ---
Sorry I better get that function in the dynamic loading correct. It calls the
actual function which goes to _dl_runtime_resolve which calls _dl_fixup, then
it bombs at the end of _dl_runtime_resolve.


[Bug c++/49587] Code generation error with dynamic libraries.

2011-06-30 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49587

--- Comment #5 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-30 
20:56:32 UTC ---
Ah, yes I think it is.


[Bug c++/49420] [C++0x] compiler segfault using result_of

2011-06-16 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49420

--- Comment #2 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-16 
22:55:44 UTC ---
That fixes it for me. Thanks.


[Bug c++/49420] New: [C++0x] compiler segfault using result_of

2011-06-15 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49420

   Summary: [C++0x] compiler segfault using result_of
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


Created attachment 24535
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24535
result of segfaults

The compiler segfaults in the attached code. It uses result_of of a struct
which has an operator() with a return type defined by recursive instantiations
of decltype.

g++ --std=gnu++0x result_of_segfault.ii
‘
In file included from result_of_segfault.cpp:1:0:
/home/jarryd/current/soft/install-latest/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:
In instantiation of ‘std::_Result_of_implfalse, false, array_get, A, int, int,
int’:
/home/jarryd/current/soft/install-latest/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/type_traits:1806:12:
  required from ‘struct std::result_ofarray_get(A, int, int, int)’
result_of_segfault.cpp:33:33:   Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jarryd/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarryd/current/soft/src/gcc-svn/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go : (reconfigured)
/home/jarryd/current/soft/src/gcc-svn/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go,lto --no-create --no-recursion : (reconfigured)
/home/jarryd/current/soft/src/gcc-svn/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go,lto --no-create --no-recursion
Thread model: posix
gcc version 4.7.0 20110615 (experimental) (GCC)


[Bug c++/49399] New: [C++0x] substitution failure error

2011-06-14 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49399

   Summary: [C++0x] substitution failure error
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


Created attachment 24515
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24515
substitution failure

When accessing a private member of a class in a substitution failure is not an
error sort of way, the compiler reports an error.

Compiling the attached code gives the following:

g++ --std=c++0x value_type.cpp
value_type.cpp: In function ‘int broken_fun(int, typename T::value_type*) [with
T = broken, typename T::value_type = int]’:
value_type.cpp:4:15: error: ‘typedef int broken::value_type’ is private
value_type.cpp:14:37: error: within this context

It works fine without c++0x mode, and on previous versions of gcc.

output of gcc -v

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/jarryd/local/gcc-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarryd/installers/gcc-svn/configure
--prefix=/home/jarryd/local/gcc-4.7 --disable-multilib
--enable-languages=c,c++,go
Thread model: posix
gcc version 4.7.0 20110614 (experimental) (GCC)


[Bug c++/49399] [C++0x] substitution failure error

2011-06-14 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49399

--- Comment #2 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-14 
11:52:58 UTC ---
By works fine I mean that the code compiles, and when it runs, the program
returns the number 4.

Maybe I'm misunderstanding how this is all supposed to work and something has
changed in the spec meaning that this is now broken. However that would mean
boost is broken too (quite possible).

It comes from BOOST_MPL_HAS_XXX_TRAIT_DEF. They use it to work out if a class
has a particular member defined. It has been working fine up until recently
when it broke with C++0x.


[Bug c++/49399] [C++0x] substitution failure error

2011-06-14 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49399

--- Comment #4 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-14 
12:21:15 UTC ---
(In reply to comment #3)
 The program should not compile.
 
 In C++03 it should fail to compile because it accesses a private member. 
 SFINAE
 does not take access control into account in C++03, so that is an error.  G++
 fails to reject the program because access checking in templates is buggy.
 
 There was a last minute change in the C++0x FDIS to make SFINAE consider 
 access
 control. The previous draft
 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf) says in
 section 14.8.2 [temp.deduct] p8 Access checking is not done as part of the
 substitution process. Consequently, when deduction succeeds, an access error
 could still result when the function is instantiated.
 That was changed in the FDIS, so accessing the private member should cause
 deduction to fail, so there is no broken_fun and the call to it in main should
 fail.  G++ 4.7 doesn't implement that change yet, so rejects the program for
 the wrong reason.
 
 If you had a second, less specific, overload of broken_fun then the program
 would still be invalid in C++03 but should be well-formed in C++0x. G++ 
 doesn't
 accept it because access checking is not done as part of the substitution
 process yet.
 
 e.g. this is valid C++0x
 
 struct broken
 {
   private:
   typedef int value_type;
 };
 
 template typename T
 int
 broken_fun(int, typename T::value_type* = 0);
 
 template typename T
 char
 broken_fun(...);
 
 int main(int argc, char* argv[])
 {
 
   return sizeof(broken_funbroken(5));
 }

Ah, I see. Well the example you gave also doesn't compile. This is exactly what
the boost library does too, I missed that part in their code, meaning that
parts of boost no longer compile with gcc 4.7.


[Bug c++/49399] [C++0x] substitution failure error

2011-06-14 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49399

--- Comment #7 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-14 
12:34:35 UTC ---
(In reply to comment #6)
 (In reply to comment #4)
  Ah, I see. Well the example you gave also doesn't compile. This is exactly 
  what
  the boost library does too, I missed that part in their code, meaning that
  parts of boost no longer compile with gcc 4.7.
 
 And I know it doesn't, as I said G++ doesn't accept it because access 
 checking
 is not done as part of the substitution process yet.
 
 Even when that's done, it will only be valid C++0x not, C++03.

Ok, I thought that was what you meant. Does this however mean that this bug is
now valid for C++0x, given what they say in the link that you gave?

If a substitution results in an invalid type or expression, type deduction
fails. An invalid type or expression is one that would be ill-formed if written
using the substituted arguments. [Note: Access checking is not done as part of
the substitution process. —end note]

Should a bug for the reverse also be filed for the C++03 part of gcc? I wonder
what boost mpl people would say about a bug report since this actually works
even though it's wrong...


[Bug c++/49399] [C++0x] substitution failure error

2011-06-14 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49399

--- Comment #8 from Jarryd Beck jarrydb at cse dot unsw.edu.au 2011-06-14 
12:35:31 UTC ---
(In reply to comment #7)
 (In reply to comment #6)
  (In reply to comment #4)
   Ah, I see. Well the example you gave also doesn't compile. This is 
   exactly what
   the boost library does too, I missed that part in their code, meaning that
   parts of boost no longer compile with gcc 4.7.
  
  And I know it doesn't, as I said G++ doesn't accept it because access 
  checking
  is not done as part of the substitution process yet.
  
  Even when that's done, it will only be valid C++0x not, C++03.
 
 Ok, I thought that was what you meant. Does this however mean that this bug is
 now valid for C++0x, given what they say in the link that you gave?
 
 If a substitution results in an invalid type or expression, type deduction
 fails. An invalid type or expression is one that would be ill-formed if 
 written
 using the substituted arguments. [Note: Access checking is not done as part of
 the substitution process. —end note]
 
 Should a bug for the reverse also be filed for the C++03 part of gcc? I wonder
 what boost mpl people would say about a bug report since this actually works
 even though it's wrong...

Sorry that should be access checking is done. This text entry didn't preserve
the strike through of the not.


[Bug c++/49356] New: C++0x decltype fails with recursive template function

2011-06-09 Thread jarrydb at cse dot unsw.edu.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49356

   Summary: C++0x decltype fails with recursive template function
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jarr...@cse.unsw.edu.au


Created attachment 24483
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24483
Recursion with decltype fails.

When decltype refers to the type of a recursive instantiation of the same
template function, it fails. The command line and output for the attached file
(the preprocessed version is attached) is as follows:

g++ --std=gnu++0x recurse.cpp -fmessage-length=72 -save-temps
recurse.cpp: In function ‘int main(int, char**)’:
recurse.cpp:43:20: error: no matching function for call to ‘multiply(
   Multiplier, int, int, int)’
recurse.cpp:43:20: note: candidates are:
recurse.cpp:25:22: note: templateclass T, class Last decltype 
   (t(last)) multiply(T, Last)
recurse.cpp:33:40: note: templateclass T, class First, class ... 
   Values decltype (multiply(t(f), multiply::values ...)) multiply(T, 
   First, Values ...)

Here are my gcc specs.
g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/jarryd/current/soft/install-latest/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jarryd/current/soft/src/gcc-svn/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go : (reconfigured)
/home/jarryd/current/soft/src/gcc-svn/configure
--prefix=/home/jarryd/current/soft/install-latest --disable-multilib
--enable-languages=c,c++,go,lto --no-create --no-recursion
Thread model: posix
gcc version 4.7.0 20110609 (experimental) (GCC)