This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57406] New: [C++11] function templates don't accept function types with ref-qualifiers as template arguments


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

            Bug ID: 57406
           Summary: [C++11] function templates don't accept function types
                    with ref-qualifiers as template arguments
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.kruegler at googlemail dot com

When attempting to update the library test cases that use the test_category
template I stumbled across compiler error that can be traced to the following
compiler test case:

The following code is rejected by gcc 4.9.0 20130519 (experimental) when
compiled with the flags

-std=c++11 -Wall -pedantic

//----------------------------------------
template<class T>
void foo() { }

int main()
{
  foo<void() const>(); // OK
  foo<void() &>(); // Error (line 7)
  foo<void() const &&>(); // Error
}
//----------------------------------------

"main.cpp||In function 'int main()':|
main.cpp|7|error: parse error in template argument list|
main.cpp|7|error: no matching function for call to 'foo()'|
main.cpp|7|note: candidate is:|
main.cpp|2|note: template<class T> void foo()|
main.cpp|2|note:   template argument deduction/substitution failed:|
main.cpp|7|error: template argument 1 is invalid|
main.cpp|8|error: parse error in template argument list|
main.cpp|8|error: no matching function for call to 'foo()'|
main.cpp|8|note: candidate is:|
main.cpp|2|note: template<class T> void foo()|
main.cpp|2|note:   template argument deduction/substitution failed:|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
"

The code should be accepted, such types are valid as template argument, as
specified by 8.3.5 p6 b5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]