[Bug c++/85846] New: [Concepts] Concept as value in initializer: bogus declared-as-implicit-template error

hstong at ca dot ibm.com gcc-bugzilla@gcc.gnu.org
Sun May 20 00:51:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85846

            Bug ID: 85846
           Summary: [Concepts] Concept as value in initializer: bogus
                    declared-as-implicit-template error
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

When a concept with a non-type prototype parameter is used as a variable
template in a context where the most vexing parse would prefer interpretation
of an ambiguous construct as naming a type, GCC produces a bogus message
about creating an implicit non-function template.

In the case below, either f is being declared as a function, or Foo<> cannot
be considered a type (and therefore, it cannot cause formation of an implicit
template through the abbreviated function template mechanism).

### SOURCE (<stdin>):
template <int = 0> concept bool Foo = true;
bool f(Foo<>);


### COMPILER INVOCATION:
g++ -fsyntax-only -xc++ -fconcepts -


### ACTUAL OUTPUT:
<stdin>:2:6: error: non-function 'f' declared as implicit template


### EXPECTED OUTPUT:
(Clean compile).


### COMPILER VERSION INFO (g++ -v):
Using built-in specs.
COLLECT_GCC=/opt/wandbox/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/opt/wandbox/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../source/configure --prefix=/opt/wandbox/gcc-head
--enable-languages=c,c++ --disable-multilib --without-ppl --without-cloog-ppl
--enable-checking=release --disable-nls --enable-lto
LDFLAGS=-Wl,-rpath,/opt/wandbox/gcc-head/lib,-rpath,/opt/wandbox/gcc-head/lib64,-rpath,/opt/wandbox/gcc-head/lib32
Thread model: posix
gcc version 9.0.0 20180518 (experimental) (GCC)


More information about the Gcc-bugs mailing list